mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-02 03:07:47 +07:00
Predict boolean type for 'when' expression of switch pattern
IDEA-274106 GitOrigin-RevId: 3f41806bc5eceea7efa2c10bc149f231b4d42262
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2f7a5590b8
commit
4bbd7cf012
@@ -0,0 +1,13 @@
|
||||
// "Create method 'isEmpty' in 'Main'" "true-preview"
|
||||
class Main {
|
||||
void foo(Object obj) {
|
||||
switch (obj) {
|
||||
case String s && isEmpty(s) -> {}
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEmpty(String s) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Create method 'isEmpty' in 'Main'" "true-preview"
|
||||
class Main {
|
||||
void foo(Object obj) {
|
||||
switch (obj) {
|
||||
case String s when isEmpty(s) -> {}
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEmpty(String s) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create method 'isEmpty' in 'Main'" "true-preview"
|
||||
class Main {
|
||||
void foo(Object obj) {
|
||||
switch (obj) {
|
||||
case String s && isEmpt<caret>y(s) -> {}
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create method 'isEmpty' in 'Main'" "true-preview"
|
||||
class Main {
|
||||
void foo(Object obj) {
|
||||
switch (obj) {
|
||||
case String s when isEmpt<caret>y(s) -> {}
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user