You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2018/04/03 14:16:48 UTC

groovy git commit: GROOVY-8523: also handle !instanceof operator (move test for 2.6)

Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X c51b6fb14 -> 63e8f2c7f


GROOVY-8523: also handle !instanceof operator (move test for 2.6)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/63e8f2c7
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/63e8f2c7
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/63e8f2c7

Branch: refs/heads/GROOVY_2_6_X
Commit: 63e8f2c7f4b2d04537b2fac4f1e95adfaf326eb6
Parents: c51b6fb
Author: Paul King <pa...@asert.com.au>
Authored: Wed Apr 4 00:16:40 2018 +1000
Committer: Paul King <pa...@asert.com.au>
Committed: Wed Apr 4 00:16:40 2018 +1000

----------------------------------------------------------------------
 src/test/groovy/bugs/Groovy8523Bug.groovy       | 29 -------------
 .../parser/antlr4/GroovyParserTest.groovy       |  1 +
 .../src/test/resources/bugs/GROOVY8523.groovy   | 43 ++++++++++++++++++++
 3 files changed, 44 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/63e8f2c7/src/test/groovy/bugs/Groovy8523Bug.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/bugs/Groovy8523Bug.groovy b/src/test/groovy/bugs/Groovy8523Bug.groovy
index d3c3165..f716c31 100755
--- a/src/test/groovy/bugs/Groovy8523Bug.groovy
+++ b/src/test/groovy/bugs/Groovy8523Bug.groovy
@@ -47,35 +47,6 @@ class Groovy8523Bug extends GroovyTestCase {
         '''
     }
 
-    void testNotInstanceof1() {
-        assertScript '''
-        import groovy.transform.CompileStatic
-        @CompileStatic
-        class Test1 {
-            static int checkRes = 0
-
-            static void f1(Object var1) {
-                if (var1 !instanceof Runnable){
-                    checkRes = 3
-                    return
-                }
-                f2(var1)
-            }
-
-            static void f2(Runnable var2) {
-                checkRes = 4
-            }
-        }
-
-        Runnable r = {}
-        Test1.f1(r)
-        assert Test1.checkRes == 4
-        Test1.f1(42)
-        assert Test1.checkRes == 3
-        '''
-    }
-
-
     void testInstanceofNot2() {
         assertScript '''
         import groovy.transform.CompileStatic

http://git-wip-us.apache.org/repos/asf/groovy/blob/63e8f2c7/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
index 601da41..25d1b4c 100644
--- a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
+++ b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
@@ -399,6 +399,7 @@ class GroovyParserTest extends GroovyTestCase {
         doRunAndTestAntlr4('bugs/BUG-GROOVY-2324.groovy')
         doTest('bugs/BUG-GROOVY-8161.groovy')
         doRunAndTestAntlr4('bugs/GROOVY-3898.groovy')
+        doRunAndTestAntlr4('bugs/GROOVY8532.groovy')
         doRunAndTestAntlr4('bugs/BUG-GROOVY-8311.groovy')
 
         if (jdk8orGreater) {

http://git-wip-us.apache.org/repos/asf/groovy/blob/63e8f2c7/subprojects/parser-antlr4/src/test/resources/bugs/GROOVY8523.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/resources/bugs/GROOVY8523.groovy b/subprojects/parser-antlr4/src/test/resources/bugs/GROOVY8523.groovy
new file mode 100644
index 0000000..7c2baf6
--- /dev/null
+++ b/subprojects/parser-antlr4/src/test/resources/bugs/GROOVY8523.groovy
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package bugs
+
+import groovy.transform.CompileStatic
+@CompileStatic
+class Test1 {
+    static int checkRes = 0
+
+    static void f1(Object var1) {
+        if (var1 !instanceof Runnable) {
+            checkRes = 3
+            return
+        }
+        f2(var1)
+    }
+
+    static void f2(Runnable var2) {
+        checkRes = 4
+    }
+}
+
+Runnable r = {}
+Test1.f1(r)
+assert Test1.checkRes == 4
+Test1.f1(42)
+assert Test1.checkRes == 3