mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-30 09:50:57 +07:00
Fixes IDEA-360403 Quick-fix for always-true pattern breaks the code GitOrigin-RevId: eb71b14424e628c6b9ea9ca115bc904447e9e7f6
19 lines
541 B
Java
19 lines
541 B
Java
// "Simplify 'u instanceof Upper(Lower l)' to true (may change semantics)" "false"
|
|
class X {
|
|
void test() {
|
|
record Lower(int a, int b) {
|
|
}
|
|
record Upper(Lower lower) {
|
|
}
|
|
|
|
Object rec = new Upper(new Lower(0, 0));
|
|
switch (rec) {
|
|
case Upper u when u instanceof <caret>Upper(Lower l) && l instanceof Lower(int a, int b) -> {
|
|
System.out.println(u);
|
|
System.out.println(l);
|
|
System.out.println(a);
|
|
}
|
|
default -> throw new IllegalStateException("Unexpected value: " + rec);
|
|
}
|
|
}
|
|
} |