Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[19] Pattern variable declared in a guard containing instanceof expression is not visible in the case block #371

Closed
jarthana opened this issue Sep 5, 2022 · 2 comments
Assignees

Comments

@jarthana
Copy link
Member

jarthana commented Sep 5, 2022

Consider this code:

	switch (r) {
		case Rectangle r1 when (r instanceof (Rectangle(ColoredPoint upperLeft2, ColoredPoint lowerRight) r2)):
		System.out.println(r2); // error reported here
		break;
		default :
			break;
	} 

This code should be allowed but ecj reports an error. Looks like the pattern variable doesn't make it to the case statement and hence to the block.

@jarthana jarthana self-assigned this Sep 5, 2022
jarthana added a commit to jarthana/eclipse.jdt.core that referenced this issue Sep 6, 2022
jarthana added a commit to jarthana/eclipse.jdt.core that referenced this issue Sep 6, 2022
jarthana added a commit that referenced this issue Sep 10, 2022
expression is not visible in the case block #371
@srikanth-sankaran
Copy link
Contributor

@jarthana - is this still open ? Looks like it is fixed by #372 ??

@jarthana
Copy link
Member Author

Yes, this should be closed.

robstryker pushed a commit to robstryker/eclipse.jdt.core that referenced this issue Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants