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
+58
Original file line number
Diff line number
Diff line change
@@ -2011,4 +2011,62 @@ public void testTypeChecked9998b() {
2011
2011
2012
2012
runConformTest(sources, "null");
2013
2013
}
2014
+
2015
+
@Test
2016
+
publicvoidtestTypeChecked10010() {
2017
+
//@formatter:off
2018
+
String[] sources = {
2019
+
"Main.groovy",
2020
+
"void m(List<String> list) { }\n" +
2021
+
"@groovy.transform.TypeChecked\n" +
2022
+
"void test() {\n" +
2023
+
" def bar = 123\n" +
2024
+
" m([\"foo\",\"$bar\"])\n" +
2025
+
" List<String> list = [\"foo\",\"$bar\"]\n" +
2026
+
"}\n",
2027
+
};
2028
+
//@formatter:on
2029
+
2030
+
runNegativeTest(sources,
2031
+
"----------\n" +
2032
+
"1. ERROR in Main.groovy (at line 5)\n" +
2033
+
"\tm([\"foo\",\"$bar\"])\n" +
2034
+
"\t^^^^^^^^^^^^^^^^^\n" +
2035
+
"Groovy:[Static type checking] - You are trying to use a GString in place of a String in a type which explicitly declares accepting String. Make sure to call toString() on all GString values.\n" +
2036
+
"----------\n" +
2037
+
"2. ERROR in Main.groovy (at line 6)\n" +
2038
+
"\tList<String> list = [\"foo\",\"$bar\"]\n" +
2039
+
"\t ^^^^^^^^^^^^^^\n" +
2040
+
"Groovy:[Static type checking] - You are trying to use a GString in place of a String in a type which explicitly declares accepting String. Make sure to call toString() on all GString values.\n" +
"Groovy:[Static type checking] - You are trying to use a GString in place of a String in a type which explicitly declares accepting String. Make sure to call toString() on all GString values.\n" +
"Groovy:[Static type checking] - You are trying to use a GString in place of a String in a type which explicitly declares accepting String. Make sure to call toString() on all GString values.\n" +
0 commit comments