You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2021/05/09 13:54:56 UTC

[groovy] branch master updated: GROOVY-8427: add test case

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

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


The following commit(s) were added to refs/heads/master by this push:
     new f59ef22  GROOVY-8427: add test case
f59ef22 is described below

commit f59ef22c69c7c8a58572988ee36aee9489bf456a
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Sun May 9 08:54:45 2021 -0500

    GROOVY-8427: add test case
---
 .../groovy/transform/stc/ClosuresSTCTest.groovy    | 26 ++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/test/groovy/transform/stc/ClosuresSTCTest.groovy b/src/test/groovy/transform/stc/ClosuresSTCTest.groovy
index fb6ffe9..81ed63d 100644
--- a/src/test/groovy/transform/stc/ClosuresSTCTest.groovy
+++ b/src/test/groovy/transform/stc/ClosuresSTCTest.groovy
@@ -131,9 +131,31 @@ class ClosuresSTCTest extends StaticTypeCheckingTestCase {
         'Possible loss of precision from long to byte'
     }
 
-    // GROOVY-9907
+    // GROOVY-8427
     void testClosureReturnTypeInference4() {
         assertScript '''
+            import java.util.function.Consumer
+
+            class C {
+                static <T> void m(T a, Consumer<T> c) {
+                    c.accept(a)
+                }
+                static void main(args) {
+                    def c = { ->
+                        int x = 0
+                        m('') {
+                            print 'void return'
+                        }
+                    }
+                    c.call()
+                }
+            }
+        '''
+    }
+
+    // GROOVY-9907
+    void testClosureReturnTypeInference5() {
+        assertScript '''
             Integer foo(x) {
                 if (x instanceof Integer) {
                     def bar = { -> return x }
@@ -146,7 +168,7 @@ class ClosuresSTCTest extends StaticTypeCheckingTestCase {
     }
 
     // GROOVY-9971
-    void testClosureReturnTypeInference5() {
+    void testClosureReturnTypeInference6() {
         assertScript '''
             def m(Closure<String> c) {
                 c.call()