-
Notifications
You must be signed in to change notification settings - Fork 148
8268663: Crash when guards contain boolean expression #41
Conversation
👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into |
Webrevs
|
String typeGuardIfTrueSwitchStatement(Object o) { | ||
Object o2 = ""; | ||
switch (o) { | ||
case Integer i && i == 0 && i < 1 && o2 instanceof String s: o = s + String.valueOf(i); return "true"; |
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.
hi, I would recommend adding more tests with ||
in the condition, and with more than one case in the switch with conditions
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.
Thanks, Vicente. I've added tests with ||
in d9e902b . One thing to note is that the tests are a bit different when writing something like: case String s && s.isEmpty() || o2 instanceof Number n ->
n
is not available here, as there is a path on which o2
is not a Number
.
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.
looks good
@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 4 new commits 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 |
/integrate |
Going to push as commit 35d867d.
Your commit was automatically rebased without conflicts. |
When Flow analyzes boolean expressions, (un-)initialized are split into (un-)initialized when true and when false. When analyzing guarded patterns, we need to handle these split values. As the only way the case's body/statements can be executed is if the case's pattern matches, we need to use the initialized values when true.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk17 pull/41/head:pull/41
$ git checkout pull/41
Update a local copy of the PR:
$ git checkout pull/41
$ git pull https://git.openjdk.java.net/jdk17 pull/41/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 41
View PR using the GUI difftool:
$ git pr show -t 41
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk17/pull/41.diff