[FIR] Put rendering of cone types in one place and change render for error types

This commit is contained in:
Dmitriy Novozhilov
2020-01-27 13:31:27 +03:00
parent a882cd98ea
commit 4303cd2fc7
21 changed files with 58 additions and 57 deletions
@@ -66,7 +66,7 @@ sealed class ConeKotlinType : ConeKotlinTypeProjection(),
abstract val nullability: ConeNullability
override fun toString(): String {
final override fun toString(): String {
return render()
}
}
@@ -90,10 +90,6 @@ class ConeClassErrorType(val reason: String) : ConeClassLikeType() {
override val nullability: ConeNullability
get() = ConeNullability.UNKNOWN
override fun toString(): String {
return "<ERROR CLASS: $reason>"
}
}
abstract class ConeLookupTagBasedType : ConeSimpleKotlinType() {
@@ -221,6 +217,10 @@ class ConeStubType(val variable: ConeTypeVariable, override val nullability: Con
open class ConeTypeVariable(name: String) : TypeVariableMarker {
val typeConstructor = ConeTypeVariableTypeConstructor(name)
val defaultType = ConeTypeVariableType(ConeNullability.NOT_NULL, typeConstructor)
override fun toString(): String {
return defaultType.toString()
}
}
class ConeTypeVariableTypeConstructor(val debugName: String) : ConeClassifierLookupTag(), TypeVariableTypeConstructorMarker {
@@ -13,8 +13,8 @@ fun ConeKotlinType.render(): String {
val nullabilitySuffix = if (this !is ConeKotlinErrorType && this !is ConeClassErrorType) nullability.suffix else ""
return when (this) {
is ConeTypeVariableType -> "TypeVariable(${this.lookupTag.name})"
is ConeDefinitelyNotNullType -> "${original.render()}!"
is ConeClassErrorType -> "class error: $reason"
is ConeDefinitelyNotNullType -> "${original.render()}!!"
is ConeClassErrorType -> "ERROR CLASS: $reason"
is ConeCapturedType -> "captured type: lowerType = ${lowerType?.render()}"
is ConeClassLikeType -> {
buildString {