diff --git a/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java b/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java index 371651360b..0428c32cf7 100644 --- a/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java +++ b/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java @@ -7343,4 +7343,27 @@ public void testCompileStatic10476() { runConformTest(sources, "[FOO, BAR, BAZ]"); } + + @Test + public void testCompileStatic10557() { + //@formatter:off + String[] sources = { + "Main.groovy", + "class C {\n" + + " def T m(java.util.function.Function f) {\n" + + " new StringReader('').withCloseable { reader ->\n" + + " f.apply(reader)\n" + + " }\n" + + " }\n" + + "}\n" + + "@groovy.transform.CompileStatic\n" + + "void test() {\n" + + " print(new C().m { it.text.empty })\n" + + "}\n" + + "test()\n", + }; + //@formatter:on + + runConformTest(sources, "true"); + } }