Skip to content

Commit

Permalink
GROOVY-9984
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Mar 23, 2021
1 parent fcbfaab commit 35b49a1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,27 @@ public void testTypeChecked9977() {
runConformTest(sources, "-1");
}

@Test
public void testTypeChecked9984() {
//@formatter:off
String[] sources = {
"Main.groovy",
"@groovy.transform.TupleConstructor(defaults=false)\n" +
"class C<T> {\n" +
" T p\n" +
"}\n" +
"@groovy.transform.TypeChecked\n" +
"void test() {\n" +
" C<Integer> c = new C<>(null)\n" +
" print c.p\n" +
"}\n" +
"test()\n",
};
//@formatter:on

runConformTest(sources, "null");
}

@Test
public void testTypeChecked9991() {
if (Float.parseFloat(System.getProperty("java.specification.version")) > 8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5675,6 +5675,9 @@ protected ClassNode inferReturnTypeGenerics(
int paramLength = parameters.length;
if (expressions.size() >= paramLength) {
for (int i = 0; i < paramLength; i += 1) {
// GRECLIPSE add -- GROOVY-9984: skip null
if (isNullConstant(expressions.get(i))) continue;
// GRECLIPSE end
boolean lastArg = (i == paramLength - 1);
ClassNode type = parameters[i].getType();
/* GRECLIPSE edit -- GROOVY-9996
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5437,6 +5437,9 @@ protected ClassNode inferReturnTypeGenerics(final ClassNode receiver, final Meth
int paramLength = parameters.length;
if (expressions.size() >= paramLength) {
for (int i = 0; i < paramLength; i += 1) {
// GRECLIPSE add -- GROOVY-9984: skip null
if (isNullConstant(expressions.get(i))) continue;
// GRECLIPSE end
boolean lastArg = (i == paramLength - 1);
ClassNode paramType = parameters[i].getType();
/* GRECLIPSE edit -- GROOVY-9996
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5403,6 +5403,9 @@ protected ClassNode inferReturnTypeGenerics(final ClassNode receiver, final Meth
int paramLength = parameters.length;
if (expressions.size() >= paramLength) {
for (int i = 0; i < paramLength; i += 1) {
// GRECLIPSE add -- GROOVY-9984: skip null
if (isNullConstant(expressions.get(i))) continue;
// GRECLIPSE end
boolean lastArg = (i == paramLength - 1);
ClassNode paramType = parameters[i].getType();
/* GRECLIPSE edit -- GROOVY-9996
Expand Down

0 comments on commit 35b49a1

Please sign in to comment.