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/02/10 17:13:55 UTC

[groovy] branch master updated: GROOVY-9934: 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 a315784  GROOVY-9934: add test case
a315784 is described below

commit a3157846207dd3979f45d0ca6eab66adf83e58e7
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 b864abc..ba0e566 100644
--- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
@@ -2431,6 +2431,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-7804
     void testParameterlessClosureToGenericSAMTypeArgumentCoercion() {
         assertScript '''