Skip to content

Commit

Permalink
GROOVY-11010 alternatives
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Aug 9, 2023
1 parent 6f1419f commit 306c496
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8203,6 +8203,31 @@ public void testCompileStatic10972() {
runConformTest(sources, "works");
}

@Test
public void testCompileStatic11010() {
assumeTrue(isParrotParser());

for (String xform : new String[] {"(String s) -> s.toInteger()", "{String s -> s.toInteger()}",
"(Function<String,Integer>) String::toInteger"/*, "String::toInteger", "this::m", "this.&m"*/}) {
//@formatter:off
String[] sources = {
"Main.groovy",
"import java.util.function.*\n" +
"<K,V> V from(Function<K,V> f) { f.apply('42') }\n" +
"<V> V from(Supplier<V> s) { s.get() }\n" +
"int m(String str) { str.toInteger() }\n" +
"@groovy.transform.CompileStatic\n" +
"void test() {\n" +
" print(from(" + xform + "))\n" +
"}\n" +
"test()\n",
};
//@formatter:on

runConformTest(sources, "42");
}
}

@Test
public void testCompileStatic11029() {
//@formatter:off
Expand Down

0 comments on commit 306c496

Please sign in to comment.