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

[20] Switch statement with record pattern illegally reported as non-exhaustive #1228

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

jarthana
Copy link
Member

@jarthana jarthana commented Jul 12, 2023

What it does

Fixes Issue #1224

How to test

Author checklist

@jarthana
Copy link
Member Author

jarthana commented Jul 12, 2023

Although the patch takes care of the incorrect error reporting, it falls short with respect to the generated code. Code generation part assumes that we can't have a total pattern and an explicit default case. While this is true for simple type patterns, we can have explicit default with total record patterns. Where we lack an explicit default, we need to generate an implicit default case (I presume at this point) and generate a MatchException if required. I will wait and see how #1099 shapes up and take this up and again.

@jarthana jarthana force-pushed the issue1224 branch 3 times, most recently from a049482 to 21741aa Compare July 18, 2023 05:16
@jarthana
Copy link
Member Author

Although the patch takes care of the incorrect error reporting, it falls short with respect to the generated code. Code generation part assumes that we can't have a total pattern and an explicit default case. While this is true for simple type patterns, we can have explicit default with total record patterns. Where we lack an explicit default, we need to generate an implicit default case (I presume at this point) and generate a MatchException if required. I will wait and see how #1099 shapes up and take this up and again.

I have commented out the test that fails. We will take it up with a different issue soon.

@jarthana jarthana merged commit bbef232 into eclipse-jdt:BETA_JAVA21 Jul 18, 2023
@jarthana jarthana deleted the issue1224 branch October 5, 2023 08:34
robstryker pushed a commit to robstryker/eclipse.jdt.core that referenced this pull request Jul 18, 2024
…xhaustive (eclipse-jdt#1228)

Fixed issue  eclipse-jdt#1224

Now, a total record pattern, which from now on called as a pattern that covers the expression type, can be mixed with an optional default case. The absence of such default should now be allowed.
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

Successfully merging this pull request may close these issues.

1 participant