mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-24 17:51:09 +07:00
When resolving PsiSwitchLabelStatement check if it participates in the fall-through semantics and if so, stop resolving unless the previous PsiSwitchLabelStatement is of the "case null" form. GitOrigin-RevId: 74af92cde51a8d8ec3bae1c2cd3819a09a44cdf9
83 lines
1.7 KiB
Java
83 lines
1.7 KiB
Java
|
|
class Main {
|
|
void f(Object o) {
|
|
switch (o) {
|
|
case null: {
|
|
}
|
|
case <error descr="Illegal fall-through to a pattern">Integer i</error>:
|
|
System.out.println(i + 1);
|
|
default:
|
|
throw new IllegalStateException("Unexpected value: " + o);
|
|
}
|
|
}
|
|
|
|
void g(Object o) {
|
|
switch (o) {
|
|
case null:
|
|
case Integer i:
|
|
System.out.println(i + 1);
|
|
default:
|
|
throw new IllegalStateException("Unexpected value: " + o);
|
|
}
|
|
}
|
|
|
|
void h(Object o) {
|
|
switch (o) {
|
|
case null: {
|
|
System.out.println();
|
|
break;
|
|
}
|
|
case Integer i:
|
|
System.out.println(i + 1);
|
|
default:
|
|
throw new IllegalStateException("Unexpected value: " + o);
|
|
}
|
|
}
|
|
|
|
void i(Object o) {
|
|
switch (o) {
|
|
case null:
|
|
System.out.println();
|
|
break;
|
|
case Integer i:
|
|
System.out.println(i + 1);
|
|
default:
|
|
throw new IllegalStateException("Unexpected value: " + o);
|
|
}
|
|
}
|
|
|
|
void k(Object o) {
|
|
switch (o) {
|
|
case String s:
|
|
System.out.println();
|
|
break;
|
|
case Integer i:
|
|
System.out.println(i + 1);
|
|
default:
|
|
throw new IllegalStateException("Unexpected value: " + o);
|
|
}
|
|
}
|
|
|
|
void l(Object o) {
|
|
switch (o) {
|
|
case String s: {
|
|
System.out.println();
|
|
break;
|
|
}
|
|
case Integer i:
|
|
System.out.println(i + 1);
|
|
default:
|
|
throw new IllegalStateException("Unexpected value: " + o);
|
|
}
|
|
}
|
|
|
|
void m(Object o) {
|
|
switch (o) {
|
|
case String s:
|
|
case Integer i:
|
|
System.out.println(<error descr="Cannot resolve symbol 'i'">i</error> + 1);
|
|
default:
|
|
throw new IllegalStateException("Unexpected value: " + o);
|
|
}
|
|
}
|
|
} |