Giter Site home page Giter Site logo

Comments (1)

srikanth-sankaran avatar srikanth-sankaran commented on July 17, 2024

This is exposed by - not caused by - a recent commit #2016

Underlying defective change was introduced via commit b4875fc made for #1517 and merged on 2024-01-29 at 09:51:08

Basically, this commit changed the method org.eclipse.jdt.internal.compiler.ast.TypePattern.bindingsWhenTrue() from being:

	@Override
	public LocalVariableBinding[] bindingsWhenTrue() {
		return this.local != null && this.local.binding != null ?
						new LocalVariableBinding[] { this.local.binding } : NO_VARIABLES;
	}

to

	@Override
	public LocalVariableBinding[] bindingsWhenTrue() {
		return this.local != null && this.local.binding != null && !this.local.isUnnamed(this.local.binding.declaringScope) ?
						new LocalVariableBinding[] { this.local.binding } : NO_VARIABLES;
	}

This is incorrect and was masked so far by the fact that we wouldn't even deconstruct the record pattern in this scenario till
#1517

Now since the unnamed pattern binding is not returned as being live, its live range in the region corresponding to "thunk" emitted by org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression.generateCode(BlockScope, CodeStream, boolean) is not closed by this chunk of code:

falseLabel.place();
for (LocalVariableBinding binding : this.pattern.bindingsWhenTrue()) {
binding.recordInitializationEndPC(codeStream.position);
}
codeStream.iconst_0();
continueLabel.place();

thereby leaving the stackmap inconsistent.

Interestingly, I had already found and fixed this problem in my private branch where I am accumulative fixes to be merged in after 4.32 master opens:

https://github.com/srikanth-sankaran/eclipse.jdt.core/blob/8bea15fd0c0cc98b2f2f8a5080e8ec87806f9207/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypePattern.java#L48-L51

from eclipse.jdt.core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.