@NotNull assertion fix

This commit is contained in:
peter
2010-03-08 20:48:49 +00:00
parent 0626d901b9
commit 59f690abc4
4 changed files with 15 additions and 4 deletions
@@ -257,7 +257,11 @@ public class GrParameterImpl extends GrVariableImpl implements GrParameter {
GrExpression left = range.getLeftOperand();
GrExpression right = range.getRightOperand();
if (right != null) {
return TypesUtil.getLeastUpperBound(left.getType(), right.getType(), range.getManager());
final PsiType leftType = left.getType();
final PsiType rightType = right.getType();
if (leftType != null && rightType != null) {
return TypesUtil.getLeastUpperBound(leftType, rightType, range.getManager());
}
}
return null;
}
@@ -133,9 +133,13 @@ public class GrClosureSignatureImpl implements GrClosureSignature {
boolean opt = parameters1[i].isOptional() && parameters2[i].isOptional();
params[i] = new GrClosureParameterImpl(/*null, */type, opt, null);
}
PsiType returnType = TypesUtil.getLeastUpperBound(signature1.getReturnType(), signature2.getReturnType(), manager);
boolean isVarArgs = signature1.isVarargs() && signature2.isVarargs();
return new GrClosureSignatureImpl(params, returnType, isVarArgs);
final PsiType s1type = signature1.getReturnType();
final PsiType s2type = signature2.getReturnType();
if (s1type != null && s2type != null) {
PsiType returnType = TypesUtil.getLeastUpperBound(s1type, s2type, manager);
boolean isVarArgs = signature1.isVarargs() && signature2.isVarargs();
return new GrClosureSignatureImpl(params, returnType, isVarArgs);
}
}
return null; //todo
}
@@ -192,6 +192,8 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
public void testGstringAssignableToStringInClosureParameter() throws Exception{doTest();}
public void testEverythingAssignableToString() throws Exception {doTest(new GroovyAssignabilityCheckInspection());}
public void testEachOverRange() throws Exception {doTest();}
public void testMethodCallWithDefaultParameters() throws Exception {doTest();}
public void testClosureWithDefaultParameters() throws Exception {doTest();}
public void testClosureCallMethodWithInapplicableArguments() throws Exception {doTest();}
@@ -0,0 +1 @@
(date1..date2).each { it }