From c0a885034a50ced00555d39931fb309d57c2101c Mon Sep 17 00:00:00 2001 From: Eric Milles Date: Sun, 17 Oct 2021 12:24:45 -0500 Subject: [PATCH] GROOVY-9500 --- .../tests/xform/StaticCompilationTests.java | 35 +++++++++++++++++++ 1 file changed, 35 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 7634d8cee3..a3a2df1323 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 @@ -5009,6 +5009,41 @@ public void testCompileStatic9454() { runConformTest(sources, "works"); } + @Test + public void testCompileStatic9500() { + //@formatter:off + String[] sources = { + "Main.groovy", + "trait Entity {\n" + + "}\n" + + "@groovy.transform.CompileStatic @SuppressWarnings('rawtypes')\n" + + "abstract class Path implements Iterable> {\n" + + " interface Segment {\n" + + " F start()\n" + + " T end()\n" + + " }\n" + + " abstract F start()\n" + + " T end\n" + + " T end() {\n" + + " end\n" + // Cannot return value of type Path$Segment on method returning type T + " }\n" + + " @Override\n" + + " void forEach(java.util.function.Consumer> action) {\n" + + " }\n" + + " @Override\n" + + " Spliterator> spliterator() {\n" + + " }\n" + + " @Override\n" + + " Iterator> iterator() {\n" + + " }\n" + + "}\n" + + "null\n", + }; + //@formatter:on + + runNegativeTest(sources, ""); + } + @Test public void testCompileStatic9517() { //@formatter:off