Create resolution context for delegated property resolve as well
^KT-48445 Fixed
This commit is contained in:
@@ -24,6 +24,8 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.OperatorCallChecker
|
||||
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession
|
||||
import org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzer
|
||||
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext
|
||||
import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode
|
||||
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemCompleter
|
||||
@@ -40,6 +42,7 @@ import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver
|
||||
import org.jetbrains.kotlin.resolve.calls.util.CallMaker
|
||||
import org.jetbrains.kotlin.resolve.constants.IntegerLiteralTypeConstructor
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.ScopeUtils
|
||||
@@ -692,7 +695,9 @@ class DelegatedPropertyResolver(
|
||||
)
|
||||
}
|
||||
|
||||
val resolutionCallbacks = psiCallResolver.createResolutionCallbacks(trace, newInferenceSession, context = null)
|
||||
val call = CallMaker.makeCall(delegateExpression, receiver)
|
||||
val resolutionContext = BasicCallResolutionContext.create(context, call, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS)
|
||||
val resolutionCallbacks = psiCallResolver.createResolutionCallbacks(trace, newInferenceSession, resolutionContext)
|
||||
val resolutionResults = newInferenceSession.resolveCandidates(resolutionCallbacks)
|
||||
|
||||
for ((name, isGet) in listOf(OperatorNameConventions.GET_VALUE to true, OperatorNameConventions.SET_VALUE to false)) {
|
||||
|
||||
+2
-5
@@ -71,7 +71,7 @@ class KotlinResolutionCallbacksImpl(
|
||||
private val doubleColonExpressionResolver: DoubleColonExpressionResolver,
|
||||
private val deprecationResolver: DeprecationResolver,
|
||||
private val moduleDescriptor: ModuleDescriptor,
|
||||
private val topLevelCallContext: BasicCallResolutionContext?,
|
||||
private val topLevelCallContext: BasicCallResolutionContext,
|
||||
private val missingSupertypesResolver: MissingSupertypesResolver
|
||||
) : KotlinResolutionCallbacks {
|
||||
class LambdaInfo(val expectedType: UnwrappedType, val contextDependency: ContextDependency) {
|
||||
@@ -160,8 +160,6 @@ class KotlinResolutionCallbacksImpl(
|
||||
|
||||
val coroutineSession =
|
||||
if (stubsForPostponedVariables.isNotEmpty()) {
|
||||
require(topLevelCallContext != null) { "Top level call context should not be null to analyze coroutine-lambda" }
|
||||
|
||||
BuilderInferenceSession(
|
||||
psiCallResolver, postponedArgumentsAnalyzer, kotlinConstraintSystemCompleter,
|
||||
callComponents, builtIns, topLevelCallContext, stubsForPostponedVariables, trace,
|
||||
@@ -303,8 +301,7 @@ class KotlinResolutionCallbacksImpl(
|
||||
|
||||
override fun disableContractsIfNecessary(resolvedAtom: ResolvedCallAtom) {
|
||||
val atom = resolvedAtom.atom as? PSIKotlinCall ?: return
|
||||
val context = topLevelCallContext ?: return
|
||||
disableContractsInsideContractsBlock(atom.psiCall, resolvedAtom.candidateDescriptor, context.scope, trace)
|
||||
disableContractsInsideContractsBlock(atom.psiCall, resolvedAtom.candidateDescriptor, topLevelCallContext.scope, trace)
|
||||
}
|
||||
|
||||
override fun convertSignedConstantToUnsigned(argument: KotlinCallArgument): IntegerValueTypeConstant? {
|
||||
|
||||
@@ -184,7 +184,7 @@ class PSICallResolver(
|
||||
private fun createResolutionCallbacks(context: BasicCallResolutionContext) =
|
||||
createResolutionCallbacks(context.trace, context.inferenceSession, context)
|
||||
|
||||
fun createResolutionCallbacks(trace: BindingTrace, inferenceSession: InferenceSession, context: BasicCallResolutionContext?) =
|
||||
fun createResolutionCallbacks(trace: BindingTrace, inferenceSession: InferenceSession, context: BasicCallResolutionContext) =
|
||||
KotlinResolutionCallbacksImpl(
|
||||
trace, expressionTypingServices, typeApproximator,
|
||||
argumentTypeResolver, languageVersionSettings, kotlinToResolvedCallTransformer,
|
||||
|
||||
Reference in New Issue
Block a user