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:
Denis Zharkov
2020-08-20 13:07:53 +03:00
parent 9ac5dd2bce
commit cee72023fa
5 changed files with 1 additions and 17 deletions
@@ -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>,
@@ -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)