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;
|
||||
}
|
||||
|
||||
|
||||
private OverloadDomain getOverloadDomain(
|
||||
@NotNull final JetScope scope,
|
||||
@NotNull JetExpression calleeExpression,
|
||||
@@ -409,7 +408,7 @@ public class JetTypeInferrer {
|
||||
expression.accept(this);
|
||||
if (result != null) {
|
||||
trace.recordExpressionType(expression, result);
|
||||
if (JetStandardClasses.isNothing(result)) {
|
||||
if (JetStandardClasses.isNothing(result) && !result.isNullable()) {
|
||||
markDominatedExpressionsAsUnreachable(expression);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,3 +151,11 @@ fun foo(a : Nothing) : Unit {
|
||||
fun fail() : Nothing {
|
||||
throw new java.lang.RuntimeException()
|
||||
}
|
||||
|
||||
fun nullIsNotNothing() : Unit {
|
||||
val x : Int? = 1
|
||||
if (x != null) {
|
||||
return
|
||||
}
|
||||
fail()
|
||||
}
|
||||
Reference in New Issue
Block a user