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 {