Skip to content

Commit 807f93f

Browse files
committed
GROOVY-9860
1 parent 84aa1de commit 807f93f

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java

+21
Original file line numberDiff line numberDiff line change
@@ -5344,6 +5344,27 @@ public void testCompileStatic9799() {
53445344
runConformTest(sources, "works");
53455345
}
53465346

5347+
@Test
5348+
public void testCompileStatic9860() {
5349+
//@formatter:off
5350+
String[] sources = {
5351+
"Main.groovy",
5352+
"@groovy.transform.CompileStatic\n" +
5353+
"class C {\n" +
5354+
" static <T> void test() {\n" +
5355+
" def bind = { T a, T b ->\n" +
5356+
" return new Tuple2<T, T>(a, b)\n" +
5357+
" }\n" +
5358+
" print bind('foo', 'bar')\n" +
5359+
" }\n" +
5360+
"}\n" +
5361+
"C.test()\n",
5362+
};
5363+
//@formatter:on
5364+
5365+
runConformTest(sources, "[foo, bar]");
5366+
}
5367+
53475368
@Test
53485369
public void testCompileStatic9863() {
53495370
//@formatter:off

base/org.codehaus.groovy30/src/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1131,8 +1131,11 @@ private static Parameter[] makeRawTypes(final Parameter[] parameters, final Map<
11311131
String name = param.getType().getUnresolvedName();
11321132
Optional<GenericsType> value = genericsPlaceholderAndTypeMap.entrySet().stream()
11331133
.filter(e -> e.getKey().getName().equals(name)).findFirst().map(Map.Entry::getValue);
1134+
/* GRECLIPSE edit -- GROOVY-9860
11341135
ClassNode type = value.map(GenericsType::getType).orElseGet(() -> makeRawType(param.getType()));
1135-
1136+
*/
1137+
ClassNode type = value.map(gt -> !gt.isPlaceholder() ? gt.getType() : makeRawType(gt.getType())).orElseGet(() -> makeRawType(param.getType()));
1138+
// GRECLIPSE end
11361139
return new Parameter(type, param.getName());
11371140
}).toArray(Parameter[]::new);
11381141
}

0 commit comments

Comments
 (0)