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
+91
Original file line number
Diff line number
Diff line change
@@ -234,6 +234,26 @@ public void testTypeChecked10() {
234
234
runConformTest(sources, "");
235
235
}
236
236
237
+
@Test
238
+
publicvoidtestTypeChecked6232() {
239
+
//@formatter:off
240
+
String[] sources = {
241
+
"Main.groovy",
242
+
"class C<T> {\n" +
243
+
" C(T x, T y) {\n" +
244
+
" }\n" +
245
+
"}\n" +
246
+
"@groovy.transform.TypeChecked\n" +
247
+
"void test() {\n" +
248
+
" C<Object> c = new C<>('a', new Object())\n" +
249
+
"}\n" +
250
+
"test()\n",
251
+
};
252
+
//@formatter:on
253
+
254
+
runConformTest(sources, "");
255
+
}
256
+
237
257
@Test
238
258
publicvoidtestTypeChecked6786() {
239
259
//@formatter:off
@@ -976,4 +996,75 @@ public void testTypeChecked9953() {
976
996
977
997
runConformTest(sources, "");
978
998
}
999
+
1000
+
@Test
1001
+
publicvoidtestTypeChecked9956() {
1002
+
//@formatter:off
1003
+
String[] sources = {
1004
+
"Main.groovy",
1005
+
"@groovy.transform.TupleConstructor\n" +
1006
+
"class C<Y> {\n" +
1007
+
" Y p\n" +
1008
+
"}\n" +
1009
+
"interface I { }\n" +
1010
+
"class D implements I { }\n" +
1011
+
"@groovy.transform.TypeChecked\n" +
1012
+
"void test() {\n" +
1013
+
" C<I> ci = new C<>(new D())\n" +
1014
+
"}\n" +
1015
+
"test()\n",
1016
+
};
1017
+
//@formatter:on
1018
+
1019
+
runConformTest(sources, "");
1020
+
}
1021
+
1022
+
@Test
1023
+
publicvoidtestTypeChecked9956a() {
1024
+
//@formatter:off
1025
+
String[] sources = {
1026
+
"Main.groovy",
1027
+
"abstract class A<X> {\n" +
1028
+
"}\n" +
1029
+
"@groovy.transform.TupleConstructor\n" +
1030
+
"class C<Y> extends A<Y> {\n" +
1031
+
" Y p\n" +
1032
+
"}\n" +
1033
+
"interface I { }\n" +
1034
+
"class D implements I { }\n" +
1035
+
"@groovy.transform.TypeChecked\n" +
1036
+
"void test() {\n" +
1037
+
" A<I> ai = new C<>(new D())\n" +
1038
+
"}\n" +
1039
+
"test()\n",
1040
+
};
1041
+
//@formatter:on
1042
+
1043
+
runConformTest(sources, "");
1044
+
}
1045
+
1046
+
@Test
1047
+
publicvoidtestTypeChecked9956b() {
1048
+
//@formatter:off
1049
+
String[] sources = {
1050
+
"Main.groovy",
1051
+
"abstract class A<X> {\n" +
1052
+
"}\n" +
1053
+
"class C<Y> extends A<Y> {\n" +
1054
+
"}\n" +
1055
+
"@groovy.transform.TypeChecked\n" +
1056
+
"void test() {\n" +
1057
+
" A<String> ax = new C<Number>()\n" +
1058
+
"}\n",
1059
+
};
1060
+
//@formatter:on
1061
+
1062
+
runNegativeTest(sources,
1063
+
"----------\n" +
1064
+
"1. ERROR in Main.groovy (at line 7)\n" +
1065
+
"\tA<String> ax = new C<Number>()\n" +
1066
+
"\t ^^^^^^^^^^^^^^^\n" +
1067
+
"Groovy:[Static type checking] - Incompatible generic argument types. Cannot assign C <Number> to: A <String>\n" +
0 commit comments