Skip to content

Commit

Permalink
GROOVY-10267, GROOVY-10576
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed May 1, 2022
1 parent 97a612e commit 82f5d45
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4576,6 +4576,26 @@ public void testTypeChecked10254() {
runConformTest(sources, "42");
}

@Test
public void testTypeChecked10267() {
//@formatter:off
String[] sources = {
"Main.groovy",
"class C<T> {\n" +
"}\n" +
"@groovy.transform.TypeChecked\n" +
"C<? extends Object> test() {\n" +
" test2()\n" +
"}\n" +
"C<? extends Object> test2() {\n" +
"}\n" +
"test()\n",
};
//@formatter:on

runConformTest(sources);
}

@Test
public void testTypeChecked10269() {
assumeTrue(isParrotParser());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,8 @@ private boolean compareGenericsWithBound(final ClassNode classNode, final ClassN
match = gt.new GenericsTypeMatcher().checkGenerics(classNodeType.getLowerBound());
} else if (classNodeType.getUpperBounds() != null) {
match = gt.new GenericsTypeMatcher().checkGenerics(classNodeType.getUpperBounds()[0]);
} else {
match = false; // "?" (from Comparable<?>) does not satisfy anything
} else { // GROOVY-10267, GROOVY-10576: "?" vs "? extends Object" (citation required) or no match
match = (!gt.isPlaceholder() && !gt.isWildcard() && ClassHelper.OBJECT_TYPE.equals(gt.getType()));
}
} else {
match = implementsInterfaceOrIsSubclassOf(classNodeType.getType(), gt.getType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ private static boolean compareGenericsWithBound(final ClassNode classNode, final
match = gt.checkGenerics(classNodeType.getLowerBound());
} else if (classNodeType.getUpperBounds() != null) {
match = gt.checkGenerics(classNodeType.getUpperBounds()[0]);
} else {
match = false; // "?" (from Comparable<?>) does not satisfy anything
} else { // GROOVY-10267, GROOVY-10576: "?" vs "? extends Object" (citation required) or no match
match = (!gt.isPlaceholder() && !gt.isWildcard() && ClassHelper.OBJECT_TYPE.equals(gt.getType()));
}
} else {
match = implementsInterfaceOrIsSubclassOf(classNodeType.getType(), gt.getType());
Expand Down

0 comments on commit 82f5d45

Please sign in to comment.