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 2021/09/10 07:09:25 UTC

[groovy] branch GROOVY_3_0_X updated (4611b20 -> 1193054)

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a change to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git.


    from 4611b20  GROOVY-9790: tweak lambda with the parameter of no explicit type
     new 4b0fff7  GROOVY-10218: BUG! exception in phase 'instruction selection' when non-existent method called
     new 1193054  GROOVY-10218: BUG! exception in phase 'instruction selection' when non-existent method called (add test case)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../transform/stc/TraitTypeCheckingExtension.java  |  1 +
 .../groovy/transform/traitx/Groovy10218.groovy}    | 25 +++++++++++-----------
 2 files changed, 14 insertions(+), 12 deletions(-)
 copy src/test/{groovy/bugs/Groovy9170.groovy => org/codehaus/groovy/transform/traitx/Groovy10218.groovy} (67%)

[groovy] 01/02: GROOVY-10218: BUG! exception in phase 'instruction selection' when non-existent method called

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 4b0fff79e1673d80af8d18e5ef0357ffc6bbd0d0
Author: Paul King <pa...@asert.com.au>
AuthorDate: Thu Sep 9 22:00:18 2021 +1000

    GROOVY-10218: BUG! exception in phase 'instruction selection' when non-existent method called
---
 .../org/codehaus/groovy/transform/stc/TraitTypeCheckingExtension.java    | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/main/java/org/codehaus/groovy/transform/stc/TraitTypeCheckingExtension.java b/src/main/java/org/codehaus/groovy/transform/stc/TraitTypeCheckingExtension.java
index f364c1e..87a9483 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/TraitTypeCheckingExtension.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/TraitTypeCheckingExtension.java
@@ -83,6 +83,7 @@ public class TraitTypeCheckingExtension extends AbstractTypeCheckingExtension {
                     candidates.add(type);
                     while (!candidates.isEmpty()) {
                         ClassNode next = candidates.remove(0);
+                        if (!Traits.isTrait(next)) continue;
                         ClassNode helper = Traits.findHelper(next);
                         Parameter[] params = new Parameter[argumentTypes.length + 1];
                         params[0] = new Parameter(ClassHelper.CLASS_Type.getPlainNodeReference(), "staticSelf");

[groovy] 02/02: GROOVY-10218: BUG! exception in phase 'instruction selection' when non-existent method called (add test case)

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 11930540e612713ecc87ac4a89b11ac18f582ea7
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri Sep 10 17:08:09 2021 +1000

    GROOVY-10218: BUG! exception in phase 'instruction selection' when non-existent method called (add test case)
---
 .../groovy/transform/traitx/Groovy10218.groovy     | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/src/test/org/codehaus/groovy/transform/traitx/Groovy10218.groovy b/src/test/org/codehaus/groovy/transform/traitx/Groovy10218.groovy
new file mode 100644
index 0000000..3299e51
--- /dev/null
+++ b/src/test/org/codehaus/groovy/transform/traitx/Groovy10218.groovy
@@ -0,0 +1,42 @@
+/*
+ *  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 org.codehaus.groovy.transform.traitx
+
+import org.junit.Test
+
+import static groovy.test.GroovyAssert.shouldFail
+
+final class Groovy10218 {
+    @Test
+    void testThatTypeCheckingDoesNotFailWhenCheckingTraitWithInterface() {
+        def ex = shouldFail '''
+            interface A {}
+
+            @groovy.transform.TypeChecked
+            trait B implements A {
+                def foo() {
+                    bar()
+                }
+            }
+
+            class C implements B {}
+        '''
+        assert ex.message.contains('[Static type checking] - Cannot find matching method B#bar()')
+    }
+}