Predict boolean type for 'when' expression of switch pattern

IDEA-274106

GitOrigin-RevId: 3f41806bc5eceea7efa2c10bc149f231b4d42262
This commit is contained in:
Andrey Cherkasov
2022-11-07 05:17:27 +04:00
committed by intellij-monorepo-bot
parent 2f7a5590b8
commit 4bbd7cf012
13 changed files with 137 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
// "Create local variable 'flag'" "true-preview"
class Foo {
void test(Object obj) {
boolean flag;
switch (obj) {
case String s && flag -> System.out.println(1);
default -> System.out.println(2);
}
}
}

View File

@@ -0,0 +1,10 @@
// "Create local variable 'flag'" "true-preview"
class Foo {
void test(Object obj) {
boolean flag;
switch (obj) {
case String s when flag -> System.out.println(1);
default -> System.out.println(2);
}
}
}

View File

@@ -0,0 +1,9 @@
// "Create local variable 'flag'" "true-preview"
class Foo {
void test(Object obj) {
switch (obj) {
case String s && flag<caret> -> System.out.println(1);
default -> System.out.println(2);
}
}
}

View File

@@ -0,0 +1,9 @@
// "Create local variable 'flag'" "true-preview"
class Foo {
void test(Object obj) {
switch (obj) {
case String s when flag<caret> -> System.out.println(1);
default -> System.out.println(2);
}
}
}