Skip to content

Commit

Permalink
GROOVY-10323
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Oct 30, 2021
1 parent 0a77b5e commit 2132dfd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4230,6 +4230,31 @@ public void testTypeChecked10320() {
runConformTest(sources, "3.3");
}

@Test
public void testTypeChecked10323() {
//@formatter:off
String[] sources = {
"Main.groovy",
"class C<T> {\n" +
"}\n" +
"def <T,T> T m(C<T> c) {\n" +
"}\n" +
"@groovy.transform.TypeChecked\n" +
"void test() {\n" +
" Number n = m(new C<>())\n" +
"}\n",
};
//@formatter:on

runNegativeTest(sources,
"----------\n" +
"1. ERROR in Main.groovy (at line 3)\n" +
"\tdef <T,T> T m(C<T> c) {\n" +
"\t ^^\n" +
"Duplicate type parameter T\n" +
"----------\n");
}

@Test
public void testTypeChecked10325() {
//@formatter:off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6339,7 +6339,7 @@ private Map<GenericsTypeName, GenericsType> extractGenericsConnectionsFromArgume

// in case of "<T, U extends Type<T>>" we can learn about "T" from resolved "U"
Map<GenericsTypeName, GenericsType> connections = Arrays.stream(methodGenericTypes)
.collect(toMap(gt -> new GenericsTypeName(gt.getName()), Function.identity()));
.collect(toMap(gt -> new GenericsTypeName(gt.getName()), gt -> gt, (v,x) -> v));
extractGenericsConnectionsForSuperClassAndInterfaces(connections, resolvedPlaceholders);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6009,7 +6009,7 @@ private Map<GenericsTypeName, GenericsType> extractGenericsConnectionsFromArgume

// in case of "<T, U extends Type<T>>" we can learn about "T" from resolved "U"
Map<GenericsTypeName, GenericsType> connections = Arrays.stream(methodGenericTypes)
.collect(toMap(gt -> new GenericsTypeName(gt.getName()), Function.identity()));
.collect(toMap(gt -> new GenericsTypeName(gt.getName()), gt -> gt, (v,x) -> v));
extractGenericsConnectionsForSuperClassAndInterfaces(connections, resolvedPlaceholders);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5491,7 +5491,7 @@ private Map<GenericsTypeName, GenericsType> extractGenericsConnectionsFromArgume

// in case of "<T, U extends Type<T>>" we can learn about "T" from resolved "U"
Map<GenericsTypeName, GenericsType> connections = Arrays.stream(methodGenericTypes)
.collect(toMap(gt -> new GenericsTypeName(gt.getName()), Function.identity()));
.collect(toMap(gt -> new GenericsTypeName(gt.getName()), gt -> gt, (v,x) -> v));
extractGenericsConnectionsForSuperClassAndInterfaces(connections, resolvedPlaceholders);
}

Expand Down

0 comments on commit 2132dfd

Please sign in to comment.