mirror of
https://github.com/github/codeql.git
synced 2026-04-23 07:45:17 +02:00
Fix switchCaseControls and hasBranchEdge to account for mixed patterns and constant cases
This commit is contained in:
@@ -38,3 +38,19 @@ Test.java:
|
||||
# 12| 0: [StringLiteral] "d"
|
||||
# 13| 3: [DefaultCase] default
|
||||
# 13| -1: [BlockStmt] { ... }
|
||||
# 15| 2: [SwitchStmt] switch (...)
|
||||
# 15| -1: [VarAccess] s
|
||||
# 16| 0: [PatternCase] case T t ...
|
||||
# 16| -3: [EQExpr] ... == ...
|
||||
# 16| 0: [MethodCall] length(...)
|
||||
# 16| -1: [VarAccess] s
|
||||
# 16| 1: [IntegerLiteral] 4
|
||||
# 16| -1: [BlockStmt] { ... }
|
||||
#-----| 0: (Single Local Variable Declaration)
|
||||
# 16| 0: [TypeAccess] String
|
||||
# 16| 1: [LocalVariableDeclExpr] s2
|
||||
# 17| 1: [ConstCase] case ...
|
||||
# 17| -1: [BlockStmt] { ... }
|
||||
# 17| 0: [StringLiteral] "e"
|
||||
# 18| 2: [DefaultCase] default
|
||||
# 18| -1: [BlockStmt] { ... }
|
||||
|
||||
@@ -12,5 +12,10 @@ class Test {
|
||||
case "d" -> { }
|
||||
default -> { }
|
||||
}
|
||||
switch (s) {
|
||||
case String s2 when s.length() == 4 -> { }
|
||||
case "e" -> { }
|
||||
default -> { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,3 +6,5 @@
|
||||
| Test.java:11:7:11:17 | case ... | Test.java:9:13:9:13 | s | Test.java:11:12:11:14 | "c" | true | true | Test.java:11:7:11:17 | case ... |
|
||||
| Test.java:12:7:12:17 | case ... | Test.java:9:13:9:13 | s | Test.java:12:12:12:14 | "d" | true | false | Test.java:13:7:13:16 | default |
|
||||
| Test.java:12:7:12:17 | case ... | Test.java:9:13:9:13 | s | Test.java:12:12:12:14 | "d" | true | true | Test.java:12:7:12:17 | case ... |
|
||||
| Test.java:17:7:17:17 | case ... | Test.java:15:13:15:13 | s | Test.java:17:12:17:14 | "e" | true | false | Test.java:18:7:18:16 | default |
|
||||
| Test.java:17:7:17:17 | case ... | Test.java:15:13:15:13 | s | Test.java:17:12:17:14 | "e" | true | true | Test.java:17:7:17:17 | case ... |
|
||||
|
||||
@@ -1 +1 @@
|
||||
//semmle-extractor-options: --javac-args -source 14 -target 14
|
||||
//semmle-extractor-options: --javac-args --release 21
|
||||
|
||||
Reference in New Issue
Block a user