From 3aa635a766d1cb2671ebe1c7f36ac986447db185 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Mon, 7 Aug 2023 18:14:08 +0200 Subject: [PATCH] K2: Fix compilation after making Candidate::symbol a var See the previous commits Explicit cast became necessary as the smart cast stopped working there --- .../kotlin/fir/resolve/calls/CallableReferenceResolution.kt | 2 +- .../kotlin/fir/resolve/calls/ConeOverloadConflictResolver.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallableReferenceResolution.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallableReferenceResolution.kt index d836d5a7564..8a0e88a2f67 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallableReferenceResolution.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallableReferenceResolution.kt @@ -48,7 +48,7 @@ internal object CheckCallableReferenceExpectedType : CheckerStage() { else -> null } - val fir: FirCallableDeclaration = candidate.symbol.fir + val fir: FirCallableDeclaration = candidate.symbol.fir as FirCallableDeclaration val (rawResultingType, callableReferenceAdaptation) = buildReflectionType(fir, resultingReceiverType, candidate, context) val resultingType = candidate.substitutor.substituteOrSelf(rawResultingType) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConeOverloadConflictResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConeOverloadConflictResolver.kt index a6eb792b003..716bf6cae18 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConeOverloadConflictResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConeOverloadConflictResolver.kt @@ -117,9 +117,10 @@ class ConeOverloadConflictResolver( } private fun Candidate.overrides(other: Candidate): Boolean { + val symbol = symbol if (symbol !is FirCallableSymbol || other.symbol !is FirCallableSymbol) return false - val otherOriginal = other.symbol.unwrapSubstitutionOverrides() + val otherOriginal = (other.symbol as FirCallableSymbol).unwrapSubstitutionOverrides() if (symbol.unwrapSubstitutionOverrides>() == otherOriginal) return true val scope = originScope as? FirTypeScope ?: return false