You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/TypeCheckedTests.java
+50
Original file line number
Diff line number
Diff line change
@@ -723,6 +723,56 @@ public void testTypeChecked8103() {
723
723
runNegativeTest(sources, "");
724
724
}
725
725
726
+
@Test
727
+
publicvoidtestTypeChecked8202() {
728
+
//@formatter:off
729
+
String[] sources = {
730
+
"Main.groovy",
731
+
"void proc() {\n" +
732
+
"}\n" +
733
+
"@groovy.transform.TypeChecked\n" +
734
+
"String test0(flag) {\n" +
735
+
" if (flag) {\n" +
736
+
" 'foo'\n" +
737
+
" } else {\n" +
738
+
" proc()\n" +
739
+
" }\n" +
740
+
"}\n" +
741
+
"@groovy.transform.TypeChecked\n" +
742
+
"String test1(flag) {\n" +
743
+
" Closure<String> c = { ->\n" +
744
+
" if (flag) {\n" +
745
+
" 'bar'\n" +
746
+
" } else {\n" +
747
+
" proc()\n" +
748
+
" null\n" +
749
+
" }\n" +
750
+
" }\n" +
751
+
" c.call()\n" +
752
+
"}\n" +
753
+
"@groovy.transform.TypeChecked\n" +
754
+
"String test2(flag) {\n" +
755
+
" Closure<String> c = { ->\n" + // Cannot assign Closure<Object> to Closure<String>
0 commit comments