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
+134
Original file line number
Diff line number
Diff line change
@@ -766,6 +766,140 @@ public void testTypeChecked8909a() {
"Groovy:[Static type checking] - Cannot assign value of type java.util.List <? super java.lang.CharSequence> to variable of type java.lang.CharSequence[]\n" +
866
+
"----------\n" +
867
+
"2. ERROR in Main.groovy (at line 5)\n" +
868
+
"\tCharSequence[] two = set\n" +
869
+
"\t ^^^\n" +
870
+
"Groovy:[Static type checking] - Cannot assign value of type java.util.Set <? super java.lang.CharSequence> to variable of type java.lang.CharSequence[]\n" +
871
+
"----------\n");
872
+
}
873
+
874
+
@Test
875
+
publicvoidtestTypeChecked8984a() {
876
+
//@formatter:off
877
+
String[] sources = {
878
+
"Main.groovy",
879
+
"List<String> m() { ['foo'] }\n" +
880
+
"@groovy.transform.TypeChecked\n" +
881
+
"void test(Set<String> set) {\n" +
882
+
" Number[] one = m()\n" +
883
+
" Number[] two = set\n" +
884
+
"}\n" +
885
+
"test(['bar'].toSet())\n",
886
+
};
887
+
//@formatter:on
888
+
889
+
runNegativeTest(sources,
890
+
"----------\n" +
891
+
"1. ERROR in Main.groovy (at line 4)\n" +
892
+
"\tNumber[] one = m()\n" +
893
+
"\t ^^^\n" +
894
+
"Groovy:[Static type checking] - Cannot assign value of type java.util.List <String> to variable of type java.lang.Number[]\n" +
895
+
"----------\n" +
896
+
"2. ERROR in Main.groovy (at line 5)\n" +
897
+
"\tNumber[] two = set\n" +
898
+
"\t ^^^\n" +
899
+
"Groovy:[Static type checking] - Cannot assign value of type java.util.Set <String> to variable of type java.lang.Number[]\n" +
0 commit comments