Don't use builder inference if possible

The builder inference is running only if there are still uninferred type variables

^KT-48193 Fixed
This commit is contained in:
Victor Petukhov
2021-08-19 08:52:49 +03:00
committed by TeamCityServer
parent 3df5667a4b
commit 55811c8851
38 changed files with 408 additions and 543 deletions
@@ -25,6 +25,7 @@ interface ConstraintSystemCompletionContext : VariableFixationFinder.Context, Re
fun canBeProper(type: KotlinTypeMarker): Boolean
fun containsOnlyFixedOrPostponedVariables(type: KotlinTypeMarker): Boolean
fun containsOnlyFixedVariables(type: KotlinTypeMarker): Boolean
// mutable operations
fun addError(error: ConstraintSystemError)
@@ -482,6 +482,14 @@ class NewConstraintSystemImpl(
}
}
override fun containsOnlyFixedVariables(type: KotlinTypeMarker): Boolean {
checkState(State.BUILDING, State.COMPLETION)
return !type.contains {
val typeConstructor = it.typeConstructor()
storage.notFixedTypeVariables.containsKey(typeConstructor)
}
}
// PostponedArgumentsAnalyzer.Context
override fun buildCurrentSubstitutor(): TypeSubstitutorMarker {
checkState(State.BUILDING, State.COMPLETION, State.TRANSACTION)