[FIR] Add toString() methods to some ConeSubstitutor implementation
This is needed only for pleasant debugging
This commit is contained in:
committed by
Space Team
parent
ba6f8e9b23
commit
8b7cfcda10
+5
-1
@@ -55,7 +55,11 @@ data class ConeStubTypeConstructor(
|
||||
val variable: ConeTypeVariable,
|
||||
val isTypeVariableInSubtyping: Boolean,
|
||||
val isForFixation: Boolean = false,
|
||||
) : TypeConstructorMarker
|
||||
) : TypeConstructorMarker {
|
||||
override fun toString(): String {
|
||||
return "Stub(${variable.typeConstructor.debugName})"
|
||||
}
|
||||
}
|
||||
|
||||
sealed class ConeStubType(val constructor: ConeStubTypeConstructor, override val nullability: ConeNullability) : StubTypeMarker,
|
||||
ConeSimpleKotlinType() {
|
||||
|
||||
+27
@@ -183,6 +183,10 @@ data class ChainedSubstitutor(private val first: ConeSubstitutor, private val se
|
||||
first.substituteOrNull(type)?.let { return second.substituteOrSelf(it) }
|
||||
return second.substituteOrNull(type)
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "$first then $second"
|
||||
}
|
||||
}
|
||||
|
||||
fun ConeSubstitutor.chain(other: ConeSubstitutor): ConeSubstitutor {
|
||||
@@ -220,6 +224,12 @@ class ConeSubstitutorByMap(
|
||||
}
|
||||
|
||||
override fun hashCode() = hashCode
|
||||
|
||||
override fun toString(): String {
|
||||
return substitution.entries.joinToString(prefix = "{", postfix = "}", separator = " | ") { (param, type) ->
|
||||
"${param.name} -> ${type.renderForDebugging()}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ConeRawScopeSubstitutor(
|
||||
@@ -292,6 +302,12 @@ internal class ConeTypeSubstitutorByTypeConstructor(
|
||||
val approximatedIntegerLiteralType = if (approximateIntegerLiterals) new.approximateIntegerLiteralType() else new
|
||||
return approximatedIntegerLiteralType.updateNullabilityIfNeeded(type)?.withCombinedAttributesFrom(type)
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return map.entries.joinToString(prefix = "{", postfix = "}", separator = " | ") { (constructor, type) ->
|
||||
"$constructor -> ${type.renderForDebugging()}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Note: builder inference uses TypeSubstitutorByTypeConstructor for not fixed type substitution
|
||||
@@ -304,6 +320,13 @@ class NotFixedTypeToVariableSubstitutorForDelegateInference(
|
||||
if (type.constructor.isTypeVariableInSubtyping) return null
|
||||
return bindings[type.constructor.variable].updateNullabilityIfNeeded(type)
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return bindings.entries.joinToString(prefix = "{", postfix = "}", separator = " | ") { (variable, type) ->
|
||||
require(variable is ConeTypeVariable)
|
||||
"TV(${variable.typeConstructor.debugName}) -> ${type.renderForDebugging()}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ConeStubAndTypeVariableToErrorTypeSubstitutor(
|
||||
@@ -328,6 +351,10 @@ class ConeStubAndTypeVariableToErrorTypeSubstitutor(
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "{<Stub type> -> <Error type>}"
|
||||
}
|
||||
}
|
||||
|
||||
fun ConeSubstitutor.replaceStubsAndTypeVariablesToErrors(
|
||||
|
||||
+4
@@ -30,4 +30,8 @@ private class TypeVariableTypeRemovingSubstitutor(typeContext: ConeTypeContext)
|
||||
}
|
||||
return ConeErrorType(ConeUnknownLambdaParameterTypeDiagnostic())
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "{<Type variable> -> <Error type>}"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user