Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/switchExpressions/ComplexTernaryInSwitch.java
Tagir Valeev 59d575280b [java-analysis] One more test for IDEA-292666
GitOrigin-RevId: 7e414c417d92f34e4a207fe5d0b97dbbde144275
2022-05-02 16:23:21 +00:00

13 lines
424 B
Java

public class ComplexTernaryInSwitch {
public void test(int x, int y, int z) {
int a;
if(switch (x) {
case 0 -> y < 0 && (a = 5) < z;
case 1 -> (y > 0 ? (a = 17) : (a = -1)) < z;
case 2 -> y > 0 ? ((a = 17) < z || 7 > z) : (3 < z || (a = -1) == a);
default -> (a = y) == 0;
}) {
System.out.println(<error descr="Variable 'a' might not have been initialized">a</error>);
}
}
}