mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 18:09:38 +07:00
[java-highlighting] IDEA-324405 Not take into account guarded cases for dominating
GitOrigin-RevId: 980851746c2e1c1e0f644540867c970598224d2a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a3e6bf2822
commit
f92fe33afa
@@ -213,7 +213,7 @@ class Main {
|
||||
}
|
||||
str = switch (ii) {
|
||||
case Integer in when in != null -> "";
|
||||
case <error descr="Label is dominated by a preceding case label 'Integer in when in != null'">1</error> -> "";
|
||||
case 1 -> "";
|
||||
default -> "";
|
||||
};
|
||||
switch (d) {
|
||||
@@ -230,10 +230,10 @@ class Main {
|
||||
|
||||
// If the type of the selector expression is an enum type E
|
||||
String str;
|
||||
switch (d) {
|
||||
switch (<error descr="'switch' statement does not cover all possible input values">d</error>) {
|
||||
case Day dd when dd != null:
|
||||
System.out.println("ok");
|
||||
case <error descr="Label is dominated by a preceding case label 'Day dd when dd != null'">MONDAY</error>:
|
||||
case MONDAY:
|
||||
System.out.println("mon");
|
||||
};
|
||||
switch (<error descr="'switch' statement does not cover all possible input values">d</error>) {
|
||||
|
||||
@@ -63,5 +63,34 @@ class X {
|
||||
}
|
||||
}
|
||||
|
||||
void dd6(String str) {
|
||||
switch (str) {
|
||||
case String i when i.length() == 2 -> System.out.println(2);
|
||||
case String i -> System.out.println(2);
|
||||
}
|
||||
}
|
||||
|
||||
void dd7(String str) {
|
||||
switch (str) {
|
||||
case String i -> System.out.println(2);
|
||||
case <error descr="Label is dominated by a preceding case label 'String i'">String i when i.length() == 2</error> -> System.out.println(2);
|
||||
}
|
||||
}
|
||||
|
||||
int testC(String str) {
|
||||
switch (str) {
|
||||
case String s when s.isEmpty()==true: return 1;
|
||||
case "": return -1;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int testC2(String str) {
|
||||
switch (str) {
|
||||
case String s: return 1;
|
||||
case <error descr="Label is dominated by a preceding case label 'String s'">""</error>: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
native static boolean predicate();
|
||||
}
|
||||
@@ -35,7 +35,7 @@ class Dominance {
|
||||
switch (integer) {
|
||||
case Integer i when i > 0 -> {
|
||||
}
|
||||
case <error descr="Label is dominated by a preceding case label 'Integer i when i > 0'">1</error> -> {
|
||||
case 1 -> {
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
|
||||
@@ -216,8 +216,8 @@ class Main {
|
||||
}
|
||||
str = switch (ii) {
|
||||
case Integer in when in != null -> "";
|
||||
case <error descr="Label is dominated by a preceding case label 'Integer in when in != null'">1</error> -> "";
|
||||
default -> "";
|
||||
case 1 -> "";
|
||||
default -> "";
|
||||
};
|
||||
switch (d) {
|
||||
case Day dd when true:
|
||||
@@ -235,10 +235,10 @@ class Main {
|
||||
|
||||
// If the type of the selector expression is an enum type E
|
||||
String str;
|
||||
switch (d) {
|
||||
switch (<error descr="'switch' statement does not cover all possible input values">d</error>) {
|
||||
case Day dd when dd != null:
|
||||
System.out.println("ok");
|
||||
case <error descr="Label is dominated by a preceding case label 'Day dd when dd != null'">MONDAY</error>:
|
||||
case MONDAY:
|
||||
System.out.println("mon");
|
||||
}
|
||||
switch (<error descr="'switch' statement does not cover all possible input values">d</error>) {
|
||||
|
||||
Reference in New Issue
Block a user