[FIR] Allow nullability mismatch in resolve

This commit is contained in:
Simon Ogorodnik
2019-04-30 17:12:22 +03:00
committed by Mikhail Glukhikh
parent 2111e56d2e
commit 5b929b88e1
@@ -97,11 +97,14 @@ fun resolvePlainArgumentType(
val position = SimpleConstraintSystemConstraintPosition //TODO val position = SimpleConstraintSystemConstraintPosition //TODO
if (!csBuilder.addSubtypeConstraintIfCompatible(argumentType, expectedType, position)) { if (!csBuilder.addSubtypeConstraintIfCompatible(argumentType, expectedType, position)) {
val nullableExpectedType = expectedType.withNullability(ConeNullability.NULLABLE)
if (!isReceiver) { if (!isReceiver) {
csBuilder.addSubtypeConstraint(argumentType, expectedType, position) if (!csBuilder.addSubtypeConstraintIfCompatible(argumentType, nullableExpectedType, position)) {
csBuilder.addSubtypeConstraint(argumentType, expectedType, position)
}
return return
} }
val nullableExpectedType = expectedType.withNullability(ConeNullability.NULLABLE)
if (csBuilder.addSubtypeConstraintIfCompatible(argumentType, nullableExpectedType, position)) { if (csBuilder.addSubtypeConstraintIfCompatible(argumentType, nullableExpectedType, position)) {
sink.reportApplicability(CandidateApplicability.WRONG_RECEIVER) // TODO sink.reportApplicability(CandidateApplicability.WRONG_RECEIVER) // TODO
} else { } else {