changeset 52899:eb75b11c373d amber-demo

Automatic merge with patterns
author mcimadamore
date Wed, 17 Oct 2018 14:05:41 +0200
parents 14f96db5f5f8 37bbcd1f1f50
children 11e665279521
files
diffstat 3 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransSwitches.java	Tue Oct 16 19:40:46 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransSwitches.java	Wed Oct 17 14:05:41 2018 +0200
@@ -207,7 +207,7 @@
                     }
                 }
             }.translate(c.stats));
-            JCCase res = make.Case(c.caseKind, c.pats, statements.toList(), null);
+            JCCase res = make.Case(JCCase.STATEMENT, c.pats, statements.toList(), null);
             res.completesNormally = c.completesNormally;
             return res;
         }
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitch-old.out	Tue Oct 16 19:40:46 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitch-old.out	Wed Oct 17 14:05:41 2018 +0200
@@ -1,3 +1,4 @@
-ExpressionSwitch.java:30:16: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.switch.expressions)
-ExpressionSwitch.java:31:20: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.switch.rules)
-2 errors
+ExpressionSwitch.java:34:16: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.switch.expressions)
+ExpressionSwitch.java:35:20: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.switch.rules)
+ExpressionSwitch.java:85:21: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.multiple.case.labels)
+3 errors
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java	Tue Oct 16 19:40:46 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java	Wed Oct 17 14:05:41 2018 +0200
@@ -23,6 +23,10 @@
         assertEquals(scopesIsolated(T.B), "B");
         assertEquals(lambdas1(T.B).get(), "B");
         assertEquals(lambdas2(T.B).get(), "B");
+        assertEquals(stringSwitchExpr("A"), "0");
+        assertEquals(stringSwitchExpr("B"), "0");
+        assertEquals(stringSwitchExpr("C"), "1");
+        assertEquals(stringSwitchExpr("X"), "D");
         localClass(T.A);
     }
 
@@ -76,6 +80,14 @@
         };
     }
 
+    private String stringSwitchExpr(String str) {
+        return switch (str) {
+            case "A", "B" -> { break "0"; }
+            case "C" -> "1";
+            default -> "D";
+        };
+    }
+
     private void localClass(T t) {
         String good = "good";
         class L {