You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PrimitiveInPatternsTest.java
+33-1Lines changed: 33 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ public class PrimitiveInPatternsTest extends AbstractRegressionTest9 {
30
30
static {
31
31
// TESTS_NUMBERS = new int [] { 1 };
32
32
// TESTS_RANGE = new int[] { 1, -1 };
33
-
// TESTS_NAMES = new String[] { "testDominanceIssue4979_002" };
33
+
// TESTS_NAMES = new String[] { "testDominanceIssue4979_002" };
34
34
}
35
35
privateStringextraLibPath;
36
36
publicstaticClass<?> testClass() {
@@ -7682,4 +7682,36 @@ public int foo1(Short c) {
7682
7682
"This case label is dominated by one of the preceding case labels\n" +
7683
7683
"----------\n");
7684
7684
}
7685
+
publicvoidtestDominanceIssue4979_003() {
7686
+
runNegativeTest(newString[] {
7687
+
"X.java",
7688
+
"""
7689
+
@SuppressWarnings("preview")
7690
+
public class X {
7691
+
void foo() {
7692
+
int j = 1;
7693
+
switch(j) {
7694
+
case byte b ->
7695
+
System.out.println("A byte");
7696
+
case 260 -> // not dominated
7697
+
System.out.println("An int that can be represented as a byte exactly");
7698
+
default ->
7699
+
System.out.println("Integer that cannot be represented as a float exactly");
7700
+
}
7701
+
}
7702
+
public static void main(String[] args) {
7703
+
Zork();
7704
+
}
7705
+
}
7706
+
"""
7707
+
},
7708
+
"----------\n" +
7709
+
"1. ERROR in X.java (at line 15)\n" +
7710
+
" Zork();\n" +
7711
+
" ^^^^\n" +
7712
+
"The method Zork() is undefined for the type X\n" +
0 commit comments