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 f0c3dd5f03b92644a9b260bc4e56000cfeb4169c Author: Eric Milles <[email protected]> AuthorDate: Sun Jul 24 11:53:48 2022 -0500 GROOVY-10674: add test case --- .../groovy/transform/stc/GenericsSTCTest.groovy | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/test/groovy/transform/stc/GenericsSTCTest.groovy b/src/test/groovy/transform/stc/GenericsSTCTest.groovy index 843abf5947..35e8642d02 100644 --- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy +++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy @@ -1488,6 +1488,41 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase { ''' } + // GROOVY-10674 + void testDiamondInferrenceFromConstructor35() { + assertScript ''' + class Foo<BB extends Bar<Byte>, X extends BB> { + X x + Foo(X x) { + this.x = x + } + } + class Bar<T extends Number> { + } + + class Baz { + static Foo<Bar<Byte>, ? super Bar<Byte>> foo = new Foo<>(new Bar<>()) + } + new Baz() + ''' + + assertScript ''' + class Foo<BBQ extends Bar<Byte, ? extends Byte>, X extends BBQ> { + X x + Foo(X x) { + this.x = x + } + } + class Bar<T extends Number, S extends T> { + } + + class Baz { + Foo<Bar<Byte,Byte>, ? super Bar<Byte,Byte>> foo = new Foo<>(new Bar<>()) + } + new Baz() + ''' + } + // GROOVY-10280 void testTypeArgumentPropagation() { assertScript '''
