FIR: Implement fast path for classes subtyping
This commit is contained in:
@@ -17,7 +17,7 @@ import java.util.*
|
||||
abstract class AbstractTypeCheckerContext : TypeSystemContext {
|
||||
|
||||
|
||||
abstract fun substitutionSupertypePolicy(type: SimpleTypeMarker): SupertypesPolicy.DoCustomTransform
|
||||
abstract fun substitutionSupertypePolicy(type: SimpleTypeMarker): SupertypesPolicy
|
||||
|
||||
abstract fun areEqualTypeConstructors(a: TypeConstructorMarker, b: TypeConstructorMarker): Boolean
|
||||
|
||||
@@ -379,6 +379,10 @@ object AbstractTypeChecker {
|
||||
baseType: SimpleTypeMarker,
|
||||
constructor: TypeConstructorMarker
|
||||
): List<SimpleTypeMarker> {
|
||||
baseType.fastCorrespondingSupertypes(constructor)?.let {
|
||||
return it
|
||||
}
|
||||
|
||||
if (constructor.isCommonFinalClassConstructor()) {
|
||||
return if (areEqualTypeConstructors(baseType.typeConstructor(), constructor))
|
||||
listOf(captureFromArguments(baseType, CaptureStatus.FOR_SUBTYPING) ?: baseType)
|
||||
|
||||
@@ -219,6 +219,8 @@ interface TypeSystemContext : TypeSystemOptimizationContext {
|
||||
|
||||
fun SimpleTypeMarker.isClassType(): Boolean = typeConstructor().isClassTypeConstructor()
|
||||
|
||||
fun SimpleTypeMarker.fastCorrespondingSupertypes(constructor: TypeConstructorMarker): List<SimpleTypeMarker>? = null
|
||||
|
||||
fun SimpleTypeMarker.isIntegerLiteralType(): Boolean = typeConstructor().isIntegerLiteralTypeConstructor()
|
||||
|
||||
fun SimpleTypeMarker.possibleIntegerTypes(): Collection<KotlinTypeMarker>
|
||||
@@ -290,4 +292,4 @@ inline fun TypeArgumentListMarker.all(
|
||||
if (!predicate(get(index))) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user