Fix for 'null is Nothing' false-positive
This commit is contained in:
@@ -120,7 +120,6 @@ public class JetTypeInferrer {
|
|||||||
return resolutionResult.isSuccess() ? resolutionResult.getFunctionDescriptor() : null;
|
return resolutionResult.isSuccess() ? resolutionResult.getFunctionDescriptor() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private OverloadDomain getOverloadDomain(
|
private OverloadDomain getOverloadDomain(
|
||||||
@NotNull final JetScope scope,
|
@NotNull final JetScope scope,
|
||||||
@NotNull JetExpression calleeExpression,
|
@NotNull JetExpression calleeExpression,
|
||||||
@@ -409,7 +408,7 @@ public class JetTypeInferrer {
|
|||||||
expression.accept(this);
|
expression.accept(this);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
trace.recordExpressionType(expression, result);
|
trace.recordExpressionType(expression, result);
|
||||||
if (JetStandardClasses.isNothing(result)) {
|
if (JetStandardClasses.isNothing(result) && !result.isNullable()) {
|
||||||
markDominatedExpressionsAsUnreachable(expression);
|
markDominatedExpressionsAsUnreachable(expression);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,3 +151,11 @@ fun foo(a : Nothing) : Unit {
|
|||||||
fun fail() : Nothing {
|
fun fail() : Nothing {
|
||||||
throw new java.lang.RuntimeException()
|
throw new java.lang.RuntimeException()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun nullIsNotNothing() : Unit {
|
||||||
|
val x : Int? = 1
|
||||||
|
if (x != null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fail()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user