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/10/10 14:14:11 UTC
[groovy] branch master updated: GROOVY-10280,
GROOVY-10283: add test cases
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 ad74b73 GROOVY-10280, GROOVY-10283: add test cases
ad74b73 is described below
commit ad74b73d9eea9fa53de72af0d795752c7c4b07c3
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Sun Oct 10 09:14:00 2021 -0500
GROOVY-10280, GROOVY-10283: add test cases
---
.../groovy/transform/stc/GenericsSTCTest.groovy | 41 ++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/src/test/groovy/transform/stc/GenericsSTCTest.groovy b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
index 93d8b68..682b4f0 100644
--- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
@@ -909,6 +909,47 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase {
}
}
+ // GROOVY-10283
+ void testDiamondInferrenceFromConstructor16() {
+ assertScript '''
+ class A<T1, T2> {
+ }
+ class B<T1 extends Number, T2 extends A<C, ? extends T1>> {
+ T2 t
+ B(T2 t) {
+ this.t = t
+ }
+ }
+ class C {
+ }
+
+ new B<Integer,A<C,Integer>>(new A<>())
+ '''
+ }
+
+ // GROOVY-10280
+ void testTypeArgumentPropagation() {
+ assertScript '''
+ class Test<T> {
+ T test() {
+ new Foo<T>().one.two.three
+ }
+ }
+ class Foo<X> {
+ Bar<X> one = new Bar<>()
+ }
+ class Bar<Y> {
+ Baz<Y> two = new Baz<>()
+ }
+ class Baz<Z> {
+ Z three
+ }
+
+ def result = new Test().test()
+ assert result == null
+ '''
+ }
+
void testLinkedListWithListArgument() {
assertScript '''
List<String> list = new LinkedList<String>(['1','2','3'])