Skip to content

Commit

Permalink
GROOVY-10375
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Nov 18, 2021
1 parent dfe32b0 commit a1c8e2a
Show file tree
Hide file tree
Showing 5 changed files with 779 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5649,7 +5649,7 @@ public void testCompileStatic9737b() {
"@groovy.transform.CompileStatic\n" +
"class C extends p.A {\n" +
" void test() {\n" +
" m('')\n" + // VerifyError: Bad access to protected data in invokevirtual
" m('')\n" + // IncompatibleClassChangeError: Found class but interface was expected
" }\n" +
"}\n" +
"new C().test()\n",
Expand Down Expand Up @@ -6597,4 +6597,29 @@ public void testCompileStatic10319() {

runConformTest(sources, "p.C([1])");
}

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

//@formatter:off
String[] sources = {
"Main.groovy",
"import java.util.function.Supplier\n" +
"@groovy.transform.CompileStatic\n" +
"class C {\n" +
" private String getX() {\n" +
" return 'works'\n" +
" }\n" +
" void test() {\n" +
" Supplier<String> s = () -> x\n" + // GroovyCastException
" print s.get()\n" +
" }\n" +
"}\n" +
"new C().test()\n",
};
//@formatter:on

runConformTest(sources, "works");
}
}
2 changes: 1 addition & 1 deletion base/org.codehaus.groovy30/.checkstyle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<file-match-pattern match-pattern="groovy/classgen/asm/StatementWriter.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticInvocationWriter.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticPropertyAccessHelper.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticTypes(CallSite|Closure|MethodReferenceExpression)Writer.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticTypes(CallSite|Closure|Lambda|MethodReferenceExpression)Writer.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/control/CompilationUnit.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/control/CompilerConfiguration.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/control/ErrorCollector.java" include-pattern="false" />
Expand Down
Loading

0 comments on commit a1c8e2a

Please sign in to comment.