8335766: Switch case with pattern matching and guard clause compiles inconsistently#20111
8335766: Switch case with pattern matching and guard clause compiles inconsistently#20111lahodaj wants to merge 1 commit intoopenjdk:jdk23from
Conversation
|
👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into |
|
@lahodaj This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 1 new commit pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
|
This backport pull request has now been updated with issue from the original commit. |
|
/integrate |
|
Going to push as commit e991c0f.
Your commit was automatically rebased without conflicts. |
Hi all,
This pull request contains a backport of commit 537d20af from the openjdk/jdk repository.
The commit being backported was authored by Jan Lahoda on 10 Jul 2024 and was reviewed by Aggelos Biboudis.
Thanks!
Original description:
When javac parser see a
caselabel, it needs to disambiguate between expressions (constant labels) and patterns. But, for code like:the parser will try to parse the label as an expression, which is obviously not correct. The problem is that it does not disambiguate before
when, and there indeed is an expression afterwhen.The proposal is to disambiguate as a pattern once there is
whenafter a closing parenthesis at the top-level. This should prevent the code to even look at thewhenexpressionProgress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20111/head:pull/20111$ git checkout pull/20111Update a local copy of the PR:
$ git checkout pull/20111$ git pull https://git.openjdk.org/jdk.git pull/20111/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20111View PR using the GUI difftool:
$ git pr show -t 20111Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20111.diff
Webrev
Link to Webrev Comment