Skip to content

Commit

Permalink
GROOVY-5692, GROOVY-10006
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Apr 8, 2021
1 parent d6c6b54 commit 94bf735
Show file tree
Hide file tree
Showing 10 changed files with 2,382 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2012,6 +2012,50 @@ public void testTypeChecked9998b() {
runConformTest(sources, "null");
}

@Test
public void testTypeChecked10006() {
//@formatter:off
String[] sources = {
"Main.groovy",
"def <T> void a(T one, T two) { }\n" +
"def <T> void b(T one, List<T> many) { }\n" +
"def <T> void c(T one, T two, T three) { }\n" +
"def <T extends Number> void d(T one, T two) { }\n" +
"@groovy.transform.TypeChecked\n" +
"void test() {\n" +
" a(1,'II')\n" +
" b(1,['II','III'])\n" +
" c(1,'II',Class)\n" +
" d(1L,2G)\n" +
"}\n",
};
//@formatter:on

runConformTest(sources, "");
}

@Test
public void testTypeChecked10006a() {
//@formatter:off
String[] sources = {
"Main.groovy",
"def <T extends Number> void d(T one, T two) { }\n" +
"@groovy.transform.TypeChecked\n" +
"void test() {\n" +
" d(1,'II')\n" +
"}\n",
};
//@formatter:on

runNegativeTest(sources,
"----------\n" +
"1. ERROR in Main.groovy (at line 4)\n" +
"\td(1,'II')\n" +
"\t^^^^^^^^^\n" +
"Groovy:[Static type checking] - Cannot find matching method Main#d(int, java.lang.String). Please check if the declared type is correct and if the method exists.\n" +
"----------\n");
}

@Test
public void testTypeChecked10010() {
//@formatter:off
Expand Down
5 changes: 2 additions & 3 deletions base/org.codehaus.groovy25/.checkstyle
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@
<file-match-pattern match-pattern="groovy/ast/expr/EmptyExpression.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/expr/FieldExpression.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/expr/(Static)?MethodCallExpression.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/tools/ExpressionUtils.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/tools/GeneralUtils.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/tools/GenericsUtils.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/tools/(Expression|General|Generics)Utils.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/tools/WideningCategories.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/AnnotationVisitor.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/AsmClassGenerator.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/Enum(Completion)?Visitor.java" include-pattern="false" />
Expand Down
Loading

0 comments on commit 94bf735

Please sign in to comment.