K2: de-prioritize invoke on dynamic receiver

This commit is contained in:
Mikhail Glukhikh
2022-07-19 15:29:13 +02:00
committed by Space
parent 766d873271
commit 220a8e47f4
@@ -639,8 +639,11 @@ internal object CheckDeprecatedSinceKotlin : ResolutionStage() {
internal object LowerPriorityIfDynamic : ResolutionStage() {
override suspend fun check(candidate: Candidate, callInfo: CallInfo, sink: CheckerSink, context: ResolutionContext) {
if (candidate.symbol.origin is FirDeclarationOrigin.DynamicScope) {
candidate.addDiagnostic(LowerPriorityForDynamic)
when {
candidate.symbol.origin is FirDeclarationOrigin.DynamicScope ->
candidate.addDiagnostic(LowerPriorityForDynamic)
candidate.callInfo.isImplicitInvoke && candidate.callInfo.explicitReceiver?.typeRef?.coneTypeSafe<ConeDynamicType>() != null ->
candidate.addDiagnostic(LowerPriorityForDynamic)
}
}
}