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:27 UTC

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

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()')
+    }
+}