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/03/14 16:51:09 UTC

[groovy] 01/04: GROOVY-10100: 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 041f90d620f96c84f5e29edb20c1633f7f3881b7
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Mon Mar 14 06:23:58 2022 -0500

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

diff --git a/src/test/groovy/transform/stc/GenericsSTCTest.groovy b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
index 5a88260..6b45ebf 100644
--- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
@@ -2581,6 +2581,24 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase {
         }
     }
 
+    // GROOVY-10100
+    void testCompatibleArgumentsForPlaceholders8() {
+        assertScript '''
+            import java.util.function.Function
+
+            class C<T> {
+                T m(Object... args) {
+                }
+            }
+            def <T extends Number> void test() {
+                C<T> c = new C<>()
+                Function<String[], T> f = c::m
+                T t = f.apply(new String[]{"string"}) // Cannot assign value of type java.lang.String[] to variable of type T
+            }
+            test()
+        '''
+    }
+
     void testIncompatibleArgumentsForPlaceholders1() {
         shouldFailWithMessages '''
             def <T extends Number> T test(T one, T two) { }