mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
[java] value break ref inside switch expression always resolves to a variable (IDEA-204204)
... even when a switch expression is not an innermost context of the break
This commit is contained in:
+17
-1
@@ -18,14 +18,30 @@ class ValueBreaks {
|
||||
|
||||
sink(switch (0) {
|
||||
case 0 -> { while (true) <error descr="Value break outside switch expression">break 42;</error> }
|
||||
case 1 -> { while (true) break <error descr="Undefined label: 'ref'">ref</error>; }
|
||||
case 1 -> { while (true) <error descr="Value break outside switch expression">break ref;</error> }
|
||||
case 2 -> { while (true) break <error descr="Undefined label: 'wtf'">wtf</error>; }
|
||||
case 3 -> { break ref; }
|
||||
case 4 -> { break (ref); }
|
||||
case 5 -> { break <error descr="Cannot resolve symbol 'wtf'">wtf</error>; }
|
||||
case 6 -> {
|
||||
int a = 0;
|
||||
a: switch (0) {
|
||||
default: break <error descr="Reference to 'a' is ambiguous, both 'a:' and 'variable a' match">a</error>;
|
||||
}
|
||||
}
|
||||
default -> throw new RuntimeException();
|
||||
});
|
||||
|
||||
switch (0) {
|
||||
case 0 -> { while (true) break <error descr="Undefined label: 'ref'">ref</error>; }
|
||||
case 1 -> {
|
||||
int a = 0;
|
||||
a: switch (0) {
|
||||
default: break a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ref: sink(switch (0) {
|
||||
default: break <error descr="Reference to 'ref' is ambiguous, both 'ref:' and 'ValueBreaks.ref' match">ref</error>;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user