File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed
java/ql/test/library-tests/switch-default-impossible-dispatch Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,23 @@ case WrapperWrapper(Wrapper(String s)) -> { }
5858 case null : default : i .take (source ()); // Can't call C1.take (but we don't currently notice)
5959 }
6060
61+ switch (i ) {
62+ case C1 _ , C2 _ :
63+ i .take (source ()); // Must be either C1.take or C2.take (but we don't currently notice, because neither dominates)
64+ break ;
65+ default :
66+ i .take (source ()); // Can't call C1.take or C2.take (but we don't currently notice, because a multi-pattern case isn't understood as a type test)
67+ }
68+
69+ switch (i ) {
70+ case C1 _ :
71+ case C2 _ :
72+ i .take (source ()); // Must be either C1.take or C2.take (but we don't currently notice, because neither dominates)
73+ break ;
74+ default :
75+ i .take (source ()); // Can't call C1.take or C2.take
76+ }
77+
6178 }
6279
6380}
Original file line number Diff line number Diff line change 1- //semmle-extractor-options: --javac-args --release 21
1+ //semmle-extractor-options: --javac-args --release 22
Original file line number Diff line number Diff line change 3030| Test.java:58:34:58:41 | source(...) | Test.java:8:65:8:65 | x |
3131| Test.java:58:34:58:41 | source(...) | Test.java:9:74:9:74 | x |
3232| Test.java:58:34:58:41 | source(...) | Test.java:10:82:10:82 | x |
33+ | Test.java:63:16:63:23 | source(...) | Test.java:7:65:7:65 | x |
34+ | Test.java:63:16:63:23 | source(...) | Test.java:8:65:8:65 | x |
35+ | Test.java:63:16:63:23 | source(...) | Test.java:9:74:9:74 | x |
36+ | Test.java:63:16:63:23 | source(...) | Test.java:10:82:10:82 | x |
37+ | Test.java:66:16:66:23 | source(...) | Test.java:7:65:7:65 | x |
38+ | Test.java:66:16:66:23 | source(...) | Test.java:8:65:8:65 | x |
39+ | Test.java:66:16:66:23 | source(...) | Test.java:9:74:9:74 | x |
40+ | Test.java:66:16:66:23 | source(...) | Test.java:10:82:10:82 | x |
41+ | Test.java:72:16:72:23 | source(...) | Test.java:7:65:7:65 | x |
42+ | Test.java:72:16:72:23 | source(...) | Test.java:8:65:8:65 | x |
43+ | Test.java:72:16:72:23 | source(...) | Test.java:9:74:9:74 | x |
44+ | Test.java:72:16:72:23 | source(...) | Test.java:10:82:10:82 | x |
45+ | Test.java:75:16:75:23 | source(...) | Test.java:9:74:9:74 | x |
46+ | Test.java:75:16:75:23 | source(...) | Test.java:10:82:10:82 | x |
You can’t perform that action at this time.
0 commit comments