NI: Get rid of confusing asConstraintSystemCompletionContext
NB: there is a different asConstraintSystemCompleterContext that might have side effects
This commit is contained in:
+6
-6
@@ -74,7 +74,7 @@ class ConstraintSystemCompleter(private val components: BodyResolveComponents, p
|
||||
|
||||
// Stage 2
|
||||
val newExpectedTypeWasBuilt = postponedArgumentsInputTypesResolver.collectParameterTypesAndBuildNewExpectedTypes(
|
||||
asConstraintSystemCompletionContext(),
|
||||
this,
|
||||
postponedArgumentsWithRevisableType,
|
||||
completionMode,
|
||||
dependencyProvider,
|
||||
@@ -88,7 +88,7 @@ class ConstraintSystemCompleter(private val components: BodyResolveComponents, p
|
||||
// Stage 3
|
||||
for (argument in postponedArguments) {
|
||||
val variableWasFixed = postponedArgumentsInputTypesResolver.fixNextReadyVariableForParameterTypeIfNeeded(
|
||||
asConstraintSystemCompletionContext(),
|
||||
this,
|
||||
argument,
|
||||
postponedArguments,
|
||||
candidateReturnType,
|
||||
@@ -104,7 +104,7 @@ class ConstraintSystemCompleter(private val components: BodyResolveComponents, p
|
||||
// Stage 4
|
||||
for (argument in postponedArgumentsWithRevisableType) {
|
||||
val argumentWasTransformed =
|
||||
transformToAtomWithNewFunctionalExpectedType(asConstraintSystemCompletionContext(), context, argument)
|
||||
transformToAtomWithNewFunctionalExpectedType(this, context, argument)
|
||||
|
||||
if (argumentWasTransformed)
|
||||
continue@completion
|
||||
@@ -215,7 +215,7 @@ class ConstraintSystemCompleter(private val components: BodyResolveComponents, p
|
||||
while (true) {
|
||||
val variableForFixation = variableFixationFinder.findFirstVariableForFixation(
|
||||
this,
|
||||
getOrderedAllTypeVariables(asConstraintSystemCompletionContext(), topLevelAtoms, collectVariablesFromContext),
|
||||
getOrderedAllTypeVariables(this, topLevelAtoms, collectVariablesFromContext),
|
||||
postponedArguments,
|
||||
completionMode,
|
||||
topLevelType
|
||||
@@ -228,13 +228,13 @@ class ConstraintSystemCompleter(private val components: BodyResolveComponents, p
|
||||
|
||||
when {
|
||||
variableForFixation.hasProperConstraint -> {
|
||||
fixVariable(asConstraintSystemCompletionContext(), topLevelType, variableWithConstraints, postponedArguments)
|
||||
fixVariable(this, topLevelType, variableWithConstraints, postponedArguments)
|
||||
return true
|
||||
}
|
||||
context.inferenceSession.isSyntheticTypeVariable(variableWithConstraints.typeVariable) -> {
|
||||
context.inferenceSession.fixSyntheticTypeVariableWithNotEnoughInformation(
|
||||
variableWithConstraints.typeVariable as ConeTypeVariable,
|
||||
asConstraintSystemCompletionContext()
|
||||
this
|
||||
)
|
||||
return true
|
||||
}
|
||||
|
||||
-2
@@ -32,7 +32,5 @@ interface ConstraintSystemCompletionContext : VariableFixationFinder.Context, Re
|
||||
|
||||
fun fixVariable(variable: TypeVariableMarker, resultType: KotlinTypeMarker, position: FixVariableConstraintPosition<*>)
|
||||
|
||||
fun asConstraintSystemCompletionContext(): ConstraintSystemCompletionContext
|
||||
|
||||
fun couldBeResolvedWithUnrestrictedBuilderInference(): Boolean
|
||||
}
|
||||
|
||||
-2
@@ -104,8 +104,6 @@ class NewConstraintSystemImpl(
|
||||
|
||||
override fun asPostponedArgumentsAnalyzerContext() = apply { checkState(State.BUILDING) }
|
||||
|
||||
override fun asConstraintSystemCompletionContext(): ConstraintSystemCompletionContext = apply { checkState(State.BUILDING) }
|
||||
|
||||
// ConstraintSystemOperation
|
||||
override fun registerVariable(variable: TypeVariableMarker) {
|
||||
checkState(State.BUILDING, State.COMPLETION, State.TRANSACTION)
|
||||
|
||||
+3
-3
@@ -96,7 +96,7 @@ class KotlinConstraintSystemCompleter(
|
||||
|
||||
// Stage 2: collect parameter types for postponed arguments
|
||||
val wasBuiltNewExpectedTypeForSomeArgument = postponedArgumentInputTypesResolver.collectParameterTypesAndBuildNewExpectedTypes(
|
||||
asConstraintSystemCompletionContext(),
|
||||
this,
|
||||
postponedArgumentsWithRevisableType,
|
||||
completionMode,
|
||||
dependencyProvider,
|
||||
@@ -110,7 +110,7 @@ class KotlinConstraintSystemCompleter(
|
||||
// Stage 3: fix variables for parameter types of all postponed arguments
|
||||
for (argument in postponedArguments) {
|
||||
val wasFixedSomeVariable = postponedArgumentInputTypesResolver.fixNextReadyVariableForParameterTypeIfNeeded(
|
||||
asConstraintSystemCompletionContext(),
|
||||
this,
|
||||
argument,
|
||||
postponedArguments,
|
||||
topLevelType,
|
||||
@@ -126,7 +126,7 @@ class KotlinConstraintSystemCompleter(
|
||||
// Stage 4: create atoms with revised expected types if needed
|
||||
for (argument in postponedArgumentsWithRevisableType) {
|
||||
val wasTransformedSomeArgument = transformToAtomWithNewFunctionalExpectedType(
|
||||
asConstraintSystemCompletionContext(), argument, diagnosticsHolder
|
||||
this, argument, diagnosticsHolder
|
||||
)
|
||||
|
||||
if (wasTransformedSomeArgument)
|
||||
|
||||
Reference in New Issue
Block a user