K2: Do not add extension receiver's constraint twice for references

The job is already done at CheckExtensionReceiver resolution stage
And repeating it might only lead to incorrect errors caused by
double-capture of receiver type that leads to contradiction because
in previous commit we started assuming different capture instantiations
as different types.
This commit is contained in:
Denis.Zharkov
2022-12-07 15:38:17 +01:00
committed by Space Team
parent 2b3f34cc52
commit 9af3e5704d
2 changed files with 10 additions and 18 deletions
@@ -70,14 +70,6 @@ internal object CheckCallableReferenceExpectedType : CheckerStage() {
) {
addSubtypeConstraint(resultingType, expectedType, position)
}
val declarationReceiverType: ConeKotlinType? =
fir.receiverParameter?.typeRef?.coneType?.let(candidate.substitutor::substituteOrSelf)
if (resultingReceiverType != null && declarationReceiverType != null) {
val capturedReceiver = context.session.typeContext.captureFromExpression(resultingReceiverType) ?: resultingReceiverType
addSubtypeConstraint(capturedReceiver, declarationReceiverType, position)
}
}
var isApplicable = true