Optimize AbstractTypeChecker::hasNothingSupertype
It doesn't make sense to go through all supertypes because Nothing is a final class
This commit is contained in:
@@ -215,14 +215,19 @@ object AbstractTypeChecker {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun AbstractTypeCheckerContext.hasNothingSupertype(type: SimpleTypeMarker) = // todo add tests
|
private fun AbstractTypeCheckerContext.hasNothingSupertype(type: SimpleTypeMarker): Boolean {
|
||||||
anySupertype(type, { it.typeConstructor().isNothingConstructor() }) {
|
val typeConstructor = type.typeConstructor()
|
||||||
|
if (typeConstructor.isClassTypeConstructor()) {
|
||||||
|
return typeConstructor.isNothingConstructor()
|
||||||
|
}
|
||||||
|
return anySupertype(type, { it.typeConstructor().isNothingConstructor() }) {
|
||||||
if (it.isClassType()) {
|
if (it.isClassType()) {
|
||||||
SupertypesPolicy.None
|
SupertypesPolicy.None
|
||||||
} else {
|
} else {
|
||||||
SupertypesPolicy.LowerIfFlexible
|
SupertypesPolicy.LowerIfFlexible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun AbstractTypeCheckerContext.isSubtypeOfForSingleClassifierType(subType: SimpleTypeMarker, superType: SimpleTypeMarker): Boolean {
|
private fun AbstractTypeCheckerContext.isSubtypeOfForSingleClassifierType(subType: SimpleTypeMarker, superType: SimpleTypeMarker): Boolean {
|
||||||
if (AbstractTypeChecker.RUN_SLOW_ASSERTIONS) {
|
if (AbstractTypeChecker.RUN_SLOW_ASSERTIONS) {
|
||||||
|
|||||||
Reference in New Issue
Block a user