FIR: Add fast-path for getOrderedAllTypeVariables if no synthetics
This commit is contained in:
committed by
teamcity
parent
8cf97127fe
commit
32a80bf38e
+3
-1
@@ -391,7 +391,9 @@ class ConstraintSystemCompleter(private val components: BodyResolveComponents, p
|
||||
topLevel.collectAllTypeVariables()
|
||||
}
|
||||
|
||||
result.addAll(c.notFixedTypeVariables.filter { context.inferenceSession.isSyntheticTypeVariable(it.value.typeVariable) }.keys.asIterable())
|
||||
if (context.inferenceSession.hasSyntheticTypeVariables()) {
|
||||
result.addAll(c.notFixedTypeVariables.filter { context.inferenceSession.isSyntheticTypeVariable(it.value.typeVariable) }.keys.asIterable())
|
||||
}
|
||||
|
||||
require(result.size == c.notFixedTypeVariables.size) {
|
||||
val notFoundTypeVariables = c.notFixedTypeVariables.keys.toMutableSet().apply { removeAll(result) }
|
||||
|
||||
+2
@@ -41,6 +41,8 @@ class FirBuilderInferenceSession(
|
||||
override val currentConstraintStorage: ConstraintStorage
|
||||
get() = ConstraintStorage.Empty
|
||||
|
||||
override fun hasSyntheticTypeVariables(): Boolean = false
|
||||
|
||||
override fun isSyntheticTypeVariable(typeVariable: TypeVariableMarker): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
+3
@@ -144,6 +144,9 @@ class FirDelegatedPropertyInferenceSession(
|
||||
return typeContext.typeSubstitutorByTypeConstructor(bindings)
|
||||
}
|
||||
|
||||
override fun hasSyntheticTypeVariables(): Boolean {
|
||||
return syntheticTypeVariableByTypeVariable.isNotEmpty()
|
||||
}
|
||||
|
||||
override fun isSyntheticTypeVariable(typeVariable: TypeVariableMarker): Boolean {
|
||||
return typeVariable in syntheticTypeVariableByTypeVariable.values
|
||||
|
||||
+2
@@ -32,6 +32,7 @@ abstract class FirInferenceSession {
|
||||
|
||||
abstract fun registerStubTypes(map: Map<TypeVariableMarker, StubTypeMarker>)
|
||||
|
||||
abstract fun hasSyntheticTypeVariables(): Boolean
|
||||
abstract fun isSyntheticTypeVariable(typeVariable: TypeVariableMarker): Boolean
|
||||
abstract fun fixSyntheticTypeVariableWithNotEnoughInformation(
|
||||
typeVariable: TypeVariableMarker,
|
||||
@@ -66,6 +67,7 @@ abstract class FirStubInferenceSession : FirInferenceSession() {
|
||||
|
||||
override fun registerStubTypes(map: Map<TypeVariableMarker, StubTypeMarker>) {}
|
||||
|
||||
override fun hasSyntheticTypeVariables(): Boolean = false
|
||||
override fun isSyntheticTypeVariable(typeVariable: TypeVariableMarker): Boolean = false
|
||||
override fun fixSyntheticTypeVariableWithNotEnoughInformation(
|
||||
typeVariable: TypeVariableMarker,
|
||||
|
||||
Reference in New Issue
Block a user