From c5f400f7d68f5f3f951d03f7c476be016429a188 Mon Sep 17 00:00:00 2001 From: Eric Milles Date: Wed, 30 Mar 2022 13:00:30 -0500 Subject: [PATCH] GROOVY-10557 --- .../tests/xform/StaticCompilationTests.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) 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"); + } }