Remove TypeSystemContext::mayBeTypeVariable optimization
It doesn't work now since anyway it's required to obtain type constructor At the same time, now it's not very expensive to obtain the constructor since it's just a lookup tag
This commit is contained in:
@@ -263,11 +263,6 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
|
||||
return this.typeConstructor
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.mayBeTypeVariable(): Boolean {
|
||||
require(this is ConeKotlinType)
|
||||
return this.typeConstructor() is ConeTypeVariableTypeConstructor
|
||||
}
|
||||
|
||||
override fun CapturedTypeMarker.typeConstructorProjection(): TypeArgumentMarker {
|
||||
require(this is ConeCapturedType)
|
||||
return this.constructor.projection
|
||||
|
||||
-5
@@ -34,11 +34,6 @@ class ClassicTypeSystemContextForCS(override val builtIns: KotlinBuiltIns) : Typ
|
||||
return this.freshTypeConstructor
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.mayBeTypeVariable(): Boolean {
|
||||
require(this is KotlinType, this::errorMessage)
|
||||
return this.constructor is TypeVariableTypeConstructor
|
||||
}
|
||||
|
||||
override fun createCapturedType(
|
||||
constructorProjection: TypeArgumentMarker,
|
||||
constructorSupertypes: List<KotlinTypeMarker>,
|
||||
|
||||
+1
-1
@@ -219,7 +219,7 @@ class ConstraintInjector(
|
||||
|
||||
// from AbstractTypeCheckerContextForConstraintSystem
|
||||
override fun isMyTypeVariable(type: SimpleTypeMarker): Boolean =
|
||||
type.mayBeTypeVariable() && c.allTypeVariables.containsKey(type.typeConstructor())
|
||||
c.allTypeVariables.containsKey(type.typeConstructor())
|
||||
|
||||
override fun addUpperConstraint(typeVariable: TypeConstructorMarker, superType: KotlinTypeMarker) =
|
||||
addConstraint(typeVariable, superType, UPPER)
|
||||
|
||||
@@ -401,10 +401,6 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
|
||||
errorSupportedOnlyInTypeInference()
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.mayBeTypeVariable(): Boolean {
|
||||
errorSupportedOnlyInTypeInference()
|
||||
}
|
||||
|
||||
override fun CapturedTypeMarker.typeConstructorProjection(): TypeArgumentMarker {
|
||||
require(this is NewCapturedType, this::errorMessage)
|
||||
return this.constructor.projection
|
||||
|
||||
@@ -155,8 +155,6 @@ interface TypeSystemInferenceExtensionContext : TypeSystemContext, TypeSystemBui
|
||||
|
||||
fun TypeVariableMarker.freshTypeConstructor(): TypeConstructorMarker
|
||||
|
||||
fun KotlinTypeMarker.mayBeTypeVariable(): Boolean
|
||||
|
||||
fun CapturedTypeMarker.typeConstructorProjection(): TypeArgumentMarker
|
||||
fun CapturedTypeMarker.typeParameter(): TypeParameterMarker?
|
||||
fun CapturedTypeMarker.withNotNullProjection(): KotlinTypeMarker
|
||||
|
||||
Reference in New Issue
Block a user