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/03/03 14:42:34 UTC

[groovy] branch GROOVY_3_0_X updated: GROOVY-9934: add test case

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

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


The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
     new 2989b71  GROOVY-9934: add test case
2989b71 is described below

commit 2989b71b639aca5fb47c270e33e9e20fe5cb2eb1
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Wed Feb 10 11:13:41 2021 -0600

    GROOVY-9934: add test case
---
 src/test/groovy/transform/stc/GenericsSTCTest.groovy | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/test/groovy/transform/stc/GenericsSTCTest.groovy b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
index 778ac2f..5008fbf 100644
--- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
@@ -2258,6 +2258,22 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase {
         }
     }
 
+    // GROOVY-9934
+    void testBoundedReturnTypeChecking2() {
+        assertScript '''
+            class Bar {
+            }
+            class Foo<T extends Bar> {
+                T method(T t) {
+                    def c = { -> t }
+                    return c() // Cannot return value of type Object on method returning type T
+                }
+            }
+            def bar = new Bar()
+            assert bar.is(new Foo<Bar>().method(bar))
+        '''
+    }
+
     // GROOVY-9981
     void testBoundedReturnTypeChecking3() {
         assertScript '''