diff options
author | Manoj Palat | 2019-03-15 00:07:05 +0000 |
---|---|---|
committer | Manoj Palat | 2019-03-15 00:07:05 +0000 |
commit | e2d24f0b92eac7f0e09c2a997511f00da5b8ed5e (patch) | |
tree | 5a58bd0973809821aa5a646086d777bab5bcf8d1 | |
parent | 3d16613b8a0e378e939a2183c4584c10eb598c9a (diff) | |
download | eclipse.jdt.core-e2d24f0b92eac7f0e09c2a997511f00da5b8ed5e.tar.gz eclipse.jdt.core-e2d24f0b92eac7f0e09c2a997511f00da5b8ed5e.tar.xz eclipse.jdt.core-e2d24f0b92eac7f0e09c2a997511f00da5b8ed5e.zip |
-rw-r--r-- | org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java index 6f4e3fbbdc..76b00319c9 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java @@ -2206,4 +2206,32 @@ public class SwitchExpressionTest extends AbstractRegressionTest { null, new String[] {"--enable-preview"}); } + // see comment 12 in the bug + public void testBug513766_01() { + this.runNegativeTest( + new String[] { + "X.java", + "public class X {\n"+ + " @SuppressWarnings(\"preview\")\n"+ + " public void foo(int i) {\n"+ + " if (switch(i) { default -> magic(); })\n"+ + " System.out.println(\"true\");\n"+ + " if (magic())\n"+ + " System.out.println(\"true, too\");\n"+ + " }\n"+ + " <T> T magic() { return null; }\n"+ + "}\n", + }, + "----------\n" + + "1. ERROR in X.java (at line 4)\n" + + " if (switch(i) { default -> magic(); })\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Type mismatch: cannot convert from Object to boolean\n" + + "----------\n" + + "2. ERROR in X.java (at line 6)\n" + + " if (magic())\n" + + " ^^^^^^^\n" + + "Type mismatch: cannot convert from Object to boolean\n" + + "----------\n"); + } }
\ No newline at end of file |