8289196: Pattern domination not working properly for record patterns #84
Conversation
👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into |
Webrevs
|
return false; | ||
} | ||
if (existingPatternType.isPrimitive()) { | ||
if (!types.isSameType(existingPatternType, currentPatternType)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: shouldn't we return true if both have the same type? I mean this method seems to returns the right thing in that case but it is doing some extra analysis that doesn't seem to be necessary IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but I am not sure if that's not "too clever". Returning true
when the type is same is based on the fact that only binding patterns (type test patterns) can be of primitive types, so the tests below will always return true
. I can do that if strongly preferred, but I somewhat like the separation of concerns, where we verify the types here, and then the structure is checked below, regardless of the pattern's type.
nit: we could probably add this test case for completeness:
|
Thanks, done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@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 34 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit 8dd94a2.
Your commit was automatically rebased without conflicts. |
When checking that a pattern in a switch case is not dominated by a preceding pattern, handling for record pattern is mostly missing. This patch is attempting to fix that, and as it requires a bit more code, it moves the check into
Check
.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk19 pull/84/head:pull/84
$ git checkout pull/84
Update a local copy of the PR:
$ git checkout pull/84
$ git pull https://git.openjdk.org/jdk19 pull/84/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 84
View PR using the GUI difftool:
$ git pr show -t 84
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk19/pull/84.diff