diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt index c8dd35201a4..4ee9e009e4f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt @@ -256,10 +256,17 @@ fun BodyResolveComponents.typeForQualifier(resolvedQualifier: FirResolvedQualifi fun BodyResolveComponents.typeFromCallee(access: T): FirResolvedTypeRef { val makeNullable: Boolean by lazy { - if (access is FirQualifiedAccess) - access.safe && access.explicitReceiver!!.resultType.coneTypeUnsafe().isNullable - else + if (access is FirQualifiedAccess && access.safe) { + val explicitReceiver = access.explicitReceiver!! + val receiverResultType = explicitReceiver.resultType + if (receiverResultType is FirResolvedTypeRef) { + receiverResultType.type.isNullable + } else { + throw AssertionError("Receiver ${explicitReceiver.render()} type is unresolved: ${receiverResultType.render()}") + } + } else { false + } } return when (val newCallee = access.calleeReference) {