Files
codeql/java/ql/test/library-tests/dataflow/switchexpr/TestSwitchExprStmtConsistency.java
Chris Smowton 04325abfa5 Add test
2022-03-31 12:26:38 +01:00

24 lines
440 B
Java

public class TestSwitchExprStmtConsistency {
static int f() { return 0; }
public static void test(int x) {
// Test that getRuleExpression() and getRuleStatement() behave alike for switch expressions and statements using arrow rules.
switch(x) {
case 1 -> f();
case 2 -> f();
default -> f();
}
int result = switch(x) {
case 1 -> f();
case 2 -> f();
default -> f();
};
}
}