From 5b929b88e13d4797062bd48cb367c12ee38710d1 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 30 Apr 2019 17:12:22 +0300 Subject: [PATCH] [FIR] Allow nullability mismatch in resolve --- .../org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt index 7f9a2250cf8..de8aef1612b 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt @@ -97,11 +97,14 @@ fun resolvePlainArgumentType( val position = SimpleConstraintSystemConstraintPosition //TODO if (!csBuilder.addSubtypeConstraintIfCompatible(argumentType, expectedType, position)) { + val nullableExpectedType = expectedType.withNullability(ConeNullability.NULLABLE) if (!isReceiver) { - csBuilder.addSubtypeConstraint(argumentType, expectedType, position) + if (!csBuilder.addSubtypeConstraintIfCompatible(argumentType, nullableExpectedType, position)) { + csBuilder.addSubtypeConstraint(argumentType, expectedType, position) + } + return } - val nullableExpectedType = expectedType.withNullability(ConeNullability.NULLABLE) if (csBuilder.addSubtypeConstraintIfCompatible(argumentType, nullableExpectedType, position)) { sink.reportApplicability(CandidateApplicability.WRONG_RECEIVER) // TODO } else {