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 2022/05/19 16:11:47 UTC

[groovy] 01/03: GROOVY-10266: add test case

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

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

commit f10d24690aa0a5215ae3d92a2dd16b2f536adfd6
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Wed May 18 10:42:58 2022 -0500

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

diff --git a/src/test/groovy/transform/stc/GenericsSTCTest.groovy b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
index 9e1f53534f..ef29fbb97c 100644
--- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
@@ -1317,6 +1317,26 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase {
         '''
     }
 
+    // GROOVY-10266
+    void testDiamondInferrenceFromConstructor30() {
+        assertScript '''
+            @groovy.transform.TupleConstructor(defaults=false)
+            class A<T> {
+                T t
+            }
+            class B<U> {
+                def m() {
+                    U v = null
+                    U w = new A<>(v).t
+
+                    String x = ""
+                    String y = new A<>(x).t
+                }
+            }
+            new B<String>().m()
+        '''
+    }
+
     // GROOVY-10280
     void testTypeArgumentPropagation() {
         assertScript '''