Add util for safe registration of type variables in constraint system
This commit is contained in:
committed by
teamcity
parent
d084cfb65b
commit
8cf97127fe
+10
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.resolve.calls.inference
|
||||
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.NewConstraintSystemImpl
|
||||
import org.jetbrains.kotlin.types.model.*
|
||||
|
||||
fun ConstraintStorage.buildCurrentSubstitutor(
|
||||
@@ -71,3 +72,12 @@ fun TypeSystemInferenceExtensionContext.extractTypeForGivenRecursiveTypeParamete
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
fun NewConstraintSystemImpl.registerTypeVariableIfNotPresent(
|
||||
typeVariable: TypeVariableMarker
|
||||
) {
|
||||
val builder = getBuilder()
|
||||
if (typeVariable.freshTypeConstructor(this) !in builder.currentStorage().allTypeVariables.keys) {
|
||||
builder.registerVariable(typeVariable)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user