Add tests for the combination of anonymous labels and a guard

This commit is contained in:
Chris Smowton
2024-03-22 21:21:41 +00:00
parent 1e0766dffa
commit c48e64e536
2 changed files with 22 additions and 6 deletions

View File

@@ -66,6 +66,14 @@ public class Test {
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)
}
switch(i) {
case C1 _, C2 _ when i.toString().equals("abc"):
i.take(source()); // Must be either C1.take or C2.take (but we don't currently notice, because neither dominates)
break;
default:
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)
}
switch(i) {
case C1 _:
case C2 _:

View File

@@ -38,9 +38,17 @@
| Test.java:66:16:66:23 | source(...) | Test.java:8:65:8:65 | x |
| Test.java:66:16:66:23 | source(...) | Test.java:9:74:9:74 | x |
| Test.java:66:16:66:23 | source(...) | Test.java:10:82:10:82 | x |
| Test.java:72:16:72:23 | source(...) | Test.java:7:65:7:65 | x |
| Test.java:72:16:72:23 | source(...) | Test.java:8:65:8:65 | x |
| Test.java:72:16:72:23 | source(...) | Test.java:9:74:9:74 | x |
| Test.java:72:16:72:23 | source(...) | Test.java:10:82:10:82 | x |
| Test.java:75:16:75:23 | source(...) | Test.java:9:74:9:74 | x |
| Test.java:75:16:75:23 | source(...) | Test.java:10:82:10:82 | x |
| Test.java:71:16:71:23 | source(...) | Test.java:7:65:7:65 | x |
| Test.java:71:16:71:23 | source(...) | Test.java:8:65:8:65 | x |
| Test.java:71:16:71:23 | source(...) | Test.java:9:74:9:74 | x |
| Test.java:71:16:71:23 | source(...) | Test.java:10:82:10:82 | x |
| Test.java:74:16:74:23 | source(...) | Test.java:7:65:7:65 | x |
| Test.java:74:16:74:23 | source(...) | Test.java:8:65:8:65 | x |
| Test.java:74:16:74:23 | source(...) | Test.java:9:74:9:74 | x |
| Test.java:74:16:74:23 | source(...) | Test.java:10:82:10:82 | x |
| Test.java:80:16:80:23 | source(...) | Test.java:7:65:7:65 | x |
| Test.java:80:16:80:23 | source(...) | Test.java:8:65:8:65 | x |
| Test.java:80:16:80:23 | source(...) | Test.java:9:74:9:74 | x |
| Test.java:80:16:80:23 | source(...) | Test.java:10:82:10:82 | x |
| Test.java:83:16:83:23 | source(...) | Test.java:9:74:9:74 | x |
| Test.java:83:16:83:23 | source(...) | Test.java:10:82:10:82 | x |