diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinResolutionCallbacksImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinResolutionCallbacksImpl.kt index 95629abafee..6a1a8e42afa 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinResolutionCallbacksImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinResolutionCallbacksImpl.kt @@ -226,21 +226,6 @@ class KotlinResolutionCallbacksImpl( ) } - override fun createReceiverWithSmartCastInfo(resolvedAtom: ResolvedCallAtom): ReceiverValueWithSmartCastInfo? { - val returnType = resolvedAtom.candidateDescriptor.returnType ?: return null - val psiKotlinCall = resolvedAtom.atom.psiKotlinCall - val callElement = psiKotlinCall.psiCall.callElement.safeAs() ?: return null - val expression = findCommonParent(callElement, resolvedAtom.atom.psiKotlinCall.explicitReceiver) - - return transformToReceiverWithSmartCastInfo( - resolvedAtom.candidateDescriptor, - trace.bindingContext, - psiKotlinCall.resultDataFlowInfo, - ExpressionReceiver.create(expression, returnType, trace.bindingContext), - languageVersionSettings, dataFlowValueFactory - ) - } - override fun isCompileTimeConstant(resolvedAtom: ResolvedCallAtom, expectedType: UnwrappedType): Boolean { val descriptor = resolvedAtom.candidateDescriptor diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ExternalComponents.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ExternalComponents.kt index d05c1c5a24e..c72bf42d617 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ExternalComponents.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ExternalComponents.kt @@ -56,8 +56,6 @@ interface KotlinResolutionCallbacks { fun bindStubResolvedCallForCandidate(candidate: ResolvedCallAtom) - fun createReceiverWithSmartCastInfo(resolvedAtom: ResolvedCallAtom): ReceiverValueWithSmartCastInfo? - fun isCompileTimeConstant(resolvedAtom: ResolvedCallAtom, expectedType: UnwrappedType): Boolean val inferenceSession: InferenceSession diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt index fb53457c8fe..9dbeeae3b58 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt @@ -41,7 +41,7 @@ class KotlinCallCompleter( } val candidate = prepareCandidateForCompletion(factory, candidates, resolutionCallbacks) - val returnType = candidate.returnTypeWithSmartCastInfo(resolutionCallbacks) + val returnType = candidate.substitutedReturnType() candidate.addExpectedTypeConstraint(returnType, expectedType) candidate.addExpectedTypeFromCastConstraint(returnType, resolutionCallbacks) @@ -65,7 +65,7 @@ class KotlinCallCompleter( val diagnosticsHolder = KotlinDiagnosticsHolder.SimpleHolder() candidate.addExpectedTypeConstraint( - candidate.returnTypeWithSmartCastInfo(resolutionCallbacks), expectedType + candidate.substitutedReturnType(), expectedType ) runCompletion( @@ -143,10 +143,9 @@ class KotlinCallCompleter( return candidate ?: factory.createErrorCandidate().forceResolution() } - private fun KotlinResolutionCandidate.returnTypeWithSmartCastInfo(resolutionCallbacks: KotlinResolutionCallbacks): UnwrappedType? { + private fun KotlinResolutionCandidate.substitutedReturnType(): UnwrappedType? { val returnType = resolvedCall.candidateDescriptor.returnType?.unwrap() ?: return null - val returnTypeWithSmartCastInfo = computeReturnTypeWithSmartCastInfo(returnType, resolutionCallbacks) - return resolvedCall.substitutor.safeSubstitute(returnTypeWithSmartCastInfo) + return resolvedCall.substitutor.safeSubstitute(returnType) } private fun KotlinResolutionCandidate.addExpectedTypeConstraint( @@ -250,14 +249,6 @@ class KotlinCallCompleter( private inline fun Iterable.anyOrAll(requireAll: Boolean, p: (T) -> Boolean): Boolean = if (requireAll) all(p) else any(p) - private fun KotlinResolutionCandidate.computeReturnTypeWithSmartCastInfo( - returnType: UnwrappedType, - resolutionCallbacks: KotlinResolutionCallbacks - ): UnwrappedType { - if (resolvedCall.atom.callKind != KotlinCallKind.VARIABLE) return returnType - return resolutionCallbacks.createReceiverWithSmartCastInfo(resolvedCall)?.stableType ?: returnType - } - fun KotlinResolutionCandidate.asCallResolutionResult( type: ConstraintSystemCompletionMode, diagnosticsHolder: KotlinDiagnosticsHolder.SimpleHolder