Pull isNullableType and related extensions up into TypeSystemContext

This commit is contained in:
Alexander Udalov
2019-06-27 00:57:33 +02:00
parent 9131ff3626
commit c452934f5b
4 changed files with 35 additions and 28 deletions
@@ -127,12 +127,6 @@ interface TypeSystemInferenceExtensionContext : TypeSystemContext, TypeSystemBui
fun CapturedTypeMarker.typeConstructorProjection(): TypeArgumentMarker
fun CapturedTypeMarker.captureStatus(): CaptureStatus
fun KotlinTypeMarker.isNullableType(): Boolean
fun KotlinTypeMarker.isNullableAny() = this.typeConstructor().isAnyConstructor() && this.isNullableType()
fun KotlinTypeMarker.isNothing() = this.typeConstructor().isNothingConstructor() && !this.isNullableType()
fun KotlinTypeMarker.isNullableNothing() = this.typeConstructor().isNothingConstructor() && this.isNullableType()
fun DefinitelyNotNullTypeMarker.original(): SimpleTypeMarker
fun typeSubstitutorByTypeConstructor(map: Map<TypeConstructorMarker, KotlinTypeMarker>): TypeSubstitutorMarker
@@ -217,6 +211,12 @@ interface TypeSystemContext : TypeSystemOptimizationContext {
fun KotlinTypeMarker.typeConstructor(): TypeConstructorMarker =
(asSimpleType() ?: lowerBoundIfFlexible()).typeConstructor()
fun KotlinTypeMarker.isNullableType(): Boolean
fun KotlinTypeMarker.isNullableAny() = this.typeConstructor().isAnyConstructor() && this.isNullableType()
fun KotlinTypeMarker.isNothing() = this.typeConstructor().isNothingConstructor() && !this.isNullableType()
fun KotlinTypeMarker.isNullableNothing() = this.typeConstructor().isNothingConstructor() && this.isNullableType()
fun SimpleTypeMarker.isClassType(): Boolean = typeConstructor().isClassTypeConstructor()
fun SimpleTypeMarker.fastCorrespondingSupertypes(constructor: TypeConstructorMarker): List<SimpleTypeMarker>? = null