Skip to content

Commit

Permalink
GROOVY-9860
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Dec 21, 2020
1 parent 84aa1de commit 807f93f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5344,6 +5344,27 @@ public void testCompileStatic9799() {
runConformTest(sources, "works");
}

@Test
public void testCompileStatic9860() {
//@formatter:off
String[] sources = {
"Main.groovy",
"@groovy.transform.CompileStatic\n" +
"class C {\n" +
" static <T> void test() {\n" +
" def bind = { T a, T b ->\n" +
" return new Tuple2<T, T>(a, b)\n" +
" }\n" +
" print bind('foo', 'bar')\n" +
" }\n" +
"}\n" +
"C.test()\n",
};
//@formatter:on

runConformTest(sources, "[foo, bar]");
}

@Test
public void testCompileStatic9863() {
//@formatter:off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,11 @@ private static Parameter[] makeRawTypes(final Parameter[] parameters, final Map<
String name = param.getType().getUnresolvedName();
Optional<GenericsType> value = genericsPlaceholderAndTypeMap.entrySet().stream()
.filter(e -> e.getKey().getName().equals(name)).findFirst().map(Map.Entry::getValue);
/* GRECLIPSE edit -- GROOVY-9860
ClassNode type = value.map(GenericsType::getType).orElseGet(() -> makeRawType(param.getType()));

*/
ClassNode type = value.map(gt -> !gt.isPlaceholder() ? gt.getType() : makeRawType(gt.getType())).orElseGet(() -> makeRawType(param.getType()));
// GRECLIPSE end
return new Parameter(type, param.getName());
}).toArray(Parameter[]::new);
}
Expand Down

0 comments on commit 807f93f

Please sign in to comment.