Skip to content

Commit 306c496

Browse files
committed
GROOVY-11010 alternatives
1 parent 6f1419f commit 306c496

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

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

+25
Original file line numberDiff line numberDiff line change
@@ -8203,6 +8203,31 @@ public void testCompileStatic10972() {
82038203
runConformTest(sources, "works");
82048204
}
82058205

8206+
@Test
8207+
public void testCompileStatic11010() {
8208+
assumeTrue(isParrotParser());
8209+
8210+
for (String xform : new String[] {"(String s) -> s.toInteger()", "{String s -> s.toInteger()}",
8211+
"(Function<String,Integer>) String::toInteger"/*, "String::toInteger", "this::m", "this.&m"*/}) {
8212+
//@formatter:off
8213+
String[] sources = {
8214+
"Main.groovy",
8215+
"import java.util.function.*\n" +
8216+
"<K,V> V from(Function<K,V> f) { f.apply('42') }\n" +
8217+
"<V> V from(Supplier<V> s) { s.get() }\n" +
8218+
"int m(String str) { str.toInteger() }\n" +
8219+
"@groovy.transform.CompileStatic\n" +
8220+
"void test() {\n" +
8221+
" print(from(" + xform + "))\n" +
8222+
"}\n" +
8223+
"test()\n",
8224+
};
8225+
//@formatter:on
8226+
8227+
runConformTest(sources, "42");
8228+
}
8229+
}
8230+
82068231
@Test
82078232
public void testCompileStatic11029() {
82088233
//@formatter:off

0 commit comments

Comments
 (0)