[FE 1.0] Store constraint system in call resolution result instead of constraint storage
This commit is contained in:
committed by
teamcity
parent
cedd98148c
commit
74f294d849
+2
@@ -98,6 +98,8 @@ interface KotlinResolutionCallbacks {
|
||||
|
||||
fun findResultType(constraintSystem: NewConstraintSystem, typeVariable: TypeVariableTypeConstructor): KotlinType?
|
||||
|
||||
fun createEmptyConstraintSystem(): NewConstraintSystem
|
||||
|
||||
fun bindStubResolvedCallForCandidate(candidate: ResolvedCallAtom)
|
||||
|
||||
fun isCompileTimeConstant(resolvedAtom: ResolvedCallAtom, expectedType: UnwrappedType): Boolean
|
||||
|
||||
+5
-5
@@ -228,7 +228,7 @@ class KotlinCallCompleter(
|
||||
|
||||
CandidateWithDiagnostics(candidate, diagnosticsHolder.getDiagnostics() + candidate.diagnostics)
|
||||
}
|
||||
return AllCandidatesResolutionResult(completedCandidates)
|
||||
return AllCandidatesResolutionResult(completedCandidates, resolutionCallbacks.createEmptyConstraintSystem())
|
||||
}
|
||||
|
||||
private fun ResolutionCandidate.runCompletion(
|
||||
@@ -350,17 +350,17 @@ class KotlinCallCompleter(
|
||||
diagnosticsHolder: KotlinDiagnosticsHolder.SimpleHolder,
|
||||
forwardToInferenceSession: Boolean = false
|
||||
): CallResolutionResult {
|
||||
val systemStorage = getSystem().asReadOnlyStorage()
|
||||
val constraintSystem = getSystem()
|
||||
val allDiagnostics = diagnosticsHolder.getDiagnostics() + diagnostics
|
||||
|
||||
if (isErrorCandidate()) {
|
||||
return ErrorCallResolutionResult(resolvedCall, allDiagnostics, systemStorage)
|
||||
return ErrorCallResolutionResult(resolvedCall, allDiagnostics, constraintSystem)
|
||||
}
|
||||
|
||||
return if (type == ConstraintSystemCompletionMode.FULL) {
|
||||
CompletedCallResolutionResult(resolvedCall, allDiagnostics, systemStorage)
|
||||
CompletedCallResolutionResult(resolvedCall, allDiagnostics, constraintSystem)
|
||||
} else {
|
||||
PartialCallResolutionResult(resolvedCall, allDiagnostics, systemStorage, forwardToInferenceSession)
|
||||
PartialCallResolutionResult(resolvedCall, allDiagnostics, constraintSystem, forwardToInferenceSession)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ fun CallableDescriptor.substituteAndApproximateTypes(
|
||||
fun PostponedArgumentsAnalyzerContext.addSubsystemFromArgument(argument: KotlinCallArgument?): Boolean {
|
||||
return when (argument) {
|
||||
is SubKotlinCallArgument -> {
|
||||
addOtherSystem(argument.callResult.constraintSystem)
|
||||
addOtherSystem(argument.callResult.constraintSystem.getBuilder().currentStorage())
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.model.*
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
|
||||
import org.jetbrains.kotlin.resolve.calls.components.candidate.ResolutionCandidate
|
||||
import org.jetbrains.kotlin.resolve.calls.components.candidate.CallableReferenceResolutionCandidate
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.NewConstraintSystem
|
||||
import org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstant
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeConstructor
|
||||
@@ -252,7 +253,7 @@ class ResolvedCollectionLiteralAtom(
|
||||
sealed class CallResolutionResult(
|
||||
resultCallAtom: ResolvedCallAtom?,
|
||||
val diagnostics: List<KotlinCallDiagnostic>,
|
||||
val constraintSystem: ConstraintStorage
|
||||
val constraintSystem: NewConstraintSystem
|
||||
) : ResolvedAtom() {
|
||||
init {
|
||||
setAnalyzedResults(listOfNotNull(resultCallAtom))
|
||||
@@ -283,31 +284,32 @@ sealed class CallResolutionResult(
|
||||
open class SingleCallResolutionResult(
|
||||
val resultCallAtom: ResolvedCallAtom,
|
||||
diagnostics: List<KotlinCallDiagnostic>,
|
||||
constraintSystem: ConstraintStorage
|
||||
constraintSystem: NewConstraintSystem
|
||||
) : CallResolutionResult(resultCallAtom, diagnostics, constraintSystem)
|
||||
|
||||
class PartialCallResolutionResult(
|
||||
resultCallAtom: ResolvedCallAtom,
|
||||
diagnostics: List<KotlinCallDiagnostic>,
|
||||
constraintSystem: ConstraintStorage,
|
||||
constraintSystem: NewConstraintSystem,
|
||||
val forwardToInferenceSession: Boolean = false
|
||||
) : SingleCallResolutionResult(resultCallAtom, diagnostics, constraintSystem)
|
||||
|
||||
class CompletedCallResolutionResult(
|
||||
resultCallAtom: ResolvedCallAtom,
|
||||
diagnostics: List<KotlinCallDiagnostic>,
|
||||
constraintSystem: ConstraintStorage
|
||||
constraintSystem: NewConstraintSystem
|
||||
) : SingleCallResolutionResult(resultCallAtom, diagnostics, constraintSystem)
|
||||
|
||||
class ErrorCallResolutionResult(
|
||||
resultCallAtom: ResolvedCallAtom,
|
||||
diagnostics: List<KotlinCallDiagnostic>,
|
||||
constraintSystem: ConstraintStorage
|
||||
constraintSystem: NewConstraintSystem
|
||||
) : SingleCallResolutionResult(resultCallAtom, diagnostics, constraintSystem)
|
||||
|
||||
class AllCandidatesResolutionResult(
|
||||
val allCandidates: Collection<CandidateWithDiagnostics>
|
||||
) : CallResolutionResult(null, emptyList(), ConstraintStorage.Empty)
|
||||
val allCandidates: Collection<CandidateWithDiagnostics>,
|
||||
constraintSystem: NewConstraintSystem
|
||||
) : CallResolutionResult(null, emptyList(), constraintSystem)
|
||||
|
||||
data class CandidateWithDiagnostics(val candidate: ResolutionCandidate, val diagnostics: List<KotlinCallDiagnostic>)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user