Rename: ConeTypeVariableType.lookupTag -> typeConstructor
This commit is contained in:
committed by
Space Team
parent
1ceec4d6d7
commit
53ab32e0fb
+2
-2
@@ -468,8 +468,8 @@ internal class KtSymbolByFirBuilder(
|
||||
}
|
||||
|
||||
is ConeTypeVariableType -> {
|
||||
val diagnostic = when ( val typeParameter = coneType.lookupTag.originalTypeParameter) {
|
||||
null -> ConeSimpleDiagnostic("Cannot infer parameter type for ${coneType.lookupTag.debugName}")
|
||||
val diagnostic = when ( val typeParameter = coneType.typeConstructor.originalTypeParameter) {
|
||||
null -> ConeSimpleDiagnostic("Cannot infer parameter type for ${coneType.typeConstructor.debugName}")
|
||||
else -> ConeCannotInferTypeParameterType((typeParameter as ConeTypeParameterLookupTag).typeParameterSymbol)
|
||||
}
|
||||
buildKtType(ConeErrorType(diagnostic, isUninferredParameter = true, attributes = coneType.attributes))
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ internal class KtFirTypeErrorType(
|
||||
override fun tryRenderAsNonErrorType(): String? = withValidityAssertion {
|
||||
when (val diagnostic = coneType.diagnostic) {
|
||||
is ConeCannotInferTypeParameterType -> diagnostic.typeParameter.name.asString()
|
||||
is ConeTypeVariableTypeIsNotInferred -> diagnostic.typeVariableType.lookupTag.debugName
|
||||
is ConeTypeVariableTypeIsNotInferred -> diagnostic.typeVariableType.typeConstructor.debugName
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -839,7 +839,7 @@ fun ConeKotlinType?.collectUpperBounds(): Set<ConeClassLikeType> {
|
||||
else -> error("missing branch for ${javaClass.name}")
|
||||
}
|
||||
is ConeTypeVariableType -> {
|
||||
val symbol = (type.lookupTag.originalTypeParameter as? ConeTypeParameterLookupTag)?.typeParameterSymbol ?: return
|
||||
val symbol = (type.typeConstructor.originalTypeParameter as? ConeTypeParameterLookupTag)?.typeParameterSymbol ?: return
|
||||
symbol.resolvedBounds.forEach { collect(it.coneType) }
|
||||
}
|
||||
is ConeDefinitelyNotNullType -> collect(type.original)
|
||||
|
||||
@@ -74,7 +74,7 @@ open class ConeTypeRenderer(
|
||||
when (type) {
|
||||
is ConeTypeVariableType -> {
|
||||
builder.append("TypeVariable(")
|
||||
builder.append(type.lookupTag.name)
|
||||
builder.append(type.typeConstructor.name)
|
||||
builder.append(")")
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.types.model.*
|
||||
|
||||
class ConeTypeVariableType(
|
||||
override val nullability: ConeNullability,
|
||||
val lookupTag: ConeTypeVariableTypeConstructor,
|
||||
val typeConstructor: ConeTypeVariableTypeConstructor,
|
||||
override val attributes: ConeAttributes = ConeAttributes.Empty,
|
||||
) : ConeSimpleKotlinType() {
|
||||
override val typeArguments: Array<out ConeTypeProjection> get() = EMPTY_ARRAY
|
||||
@@ -21,7 +21,7 @@ class ConeTypeVariableType(
|
||||
if (other !is ConeTypeVariableType) return false
|
||||
|
||||
if (nullability != other.nullability) return false
|
||||
if (lookupTag != other.lookupTag) return false
|
||||
if (typeConstructor != other.typeConstructor) return false
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class ConeTypeVariableType(
|
||||
override fun hashCode(): Int {
|
||||
var result = 0
|
||||
result = 31 * result + nullability.hashCode()
|
||||
result = 31 * result + lookupTag.hashCode()
|
||||
result = 31 * result + typeConstructor.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
@@ -849,7 +849,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
|
||||
simpleName(type.lookupTag.name)
|
||||
}
|
||||
}
|
||||
is ConeTypeVariableType -> resolved { +type.lookupTag.name.asString() }
|
||||
is ConeTypeVariableType -> resolved { +type.typeConstructor.name.asString() }
|
||||
is ConeFlexibleType -> resolved { generate(type) }
|
||||
is ConeCapturedType -> inlineUnsupported(type)
|
||||
is ConeDefinitelyNotNullType -> resolved {
|
||||
|
||||
@@ -131,7 +131,7 @@ fun ConeKotlinType.findClassRepresentation(
|
||||
is ConeIntegerLiteralType -> possibleTypes.findClassRepresentationThatIsSubtypeOf(dispatchReceiverParameterType, session)
|
||||
is ConeIntersectionType -> intersectedTypes.findClassRepresentationThatIsSubtypeOf(dispatchReceiverParameterType, session)
|
||||
is ConeTypeParameterType -> lookupTag.findClassRepresentationThatIsSubtypeOf(dispatchReceiverParameterType, session)
|
||||
is ConeTypeVariableType -> (this.lookupTag.originalTypeParameter as? ConeTypeParameterLookupTag)
|
||||
is ConeTypeVariableType -> (this.typeConstructor.originalTypeParameter as? ConeTypeParameterLookupTag)
|
||||
?.findClassRepresentationThatIsSubtypeOf(dispatchReceiverParameterType, session)
|
||||
is ConeStubType -> (this.constructor.variable.typeConstructor.originalTypeParameter as? ConeTypeParameterLookupTag)
|
||||
?.findClassRepresentationThatIsSubtypeOf(dispatchReceiverParameterType, session)
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.jetbrains.kotlin.types.TypeCheckerState.SupertypesPolicy.LowerIfFlexi
|
||||
import org.jetbrains.kotlin.types.TypeSystemCommonBackendContext
|
||||
import org.jetbrains.kotlin.types.model.*
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.withPsiEntry
|
||||
|
||||
class ErrorTypeConstructor(val reason: String) : TypeConstructorMarker {
|
||||
override fun toString(): String = reason
|
||||
@@ -156,7 +155,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
is ConeClassLikeType -> lookupTag
|
||||
is ConeTypeParameterType -> lookupTag
|
||||
is ConeCapturedType -> constructor
|
||||
is ConeTypeVariableType -> lookupTag
|
||||
is ConeTypeVariableType -> typeConstructor
|
||||
is ConeIntersectionType -> this
|
||||
is ConeStubType -> constructor
|
||||
is ConeDefinitelyNotNullType -> original.typeConstructor()
|
||||
@@ -492,7 +491,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
// And while it seems reasonable to have similar semantics as for stub types, it would make some diagnostic test failing
|
||||
// Thus, we leave the same semantics only for stubs (similar to TypeUtils.isNullableType)
|
||||
is ConeStubType -> {
|
||||
val symbol = (this.constructor.variable.defaultType.lookupTag.originalTypeParameter as? ConeTypeParameterLookupTag)?.symbol
|
||||
val symbol = (this.constructor.variable.defaultType.typeConstructor.originalTypeParameter as? ConeTypeParameterLookupTag)?.symbol
|
||||
symbol == null || symbol.allBoundsAreNullableOrUnresolved()
|
||||
}
|
||||
is ConeIntersectionType -> intersectedTypes.all { it.isNullableType() }
|
||||
|
||||
@@ -236,7 +236,7 @@ fun <T : ConeKotlinType> T.withAttributes(attributes: ConeAttributes): T {
|
||||
is ConeRawType -> ConeRawType.create(lowerBound.withAttributes(attributes), upperBound.withAttributes(attributes))
|
||||
is ConeDynamicType -> ConeDynamicType(lowerBound.withAttributes(attributes), upperBound.withAttributes(attributes))
|
||||
is ConeFlexibleType -> ConeFlexibleType(lowerBound.withAttributes(attributes), upperBound.withAttributes(attributes))
|
||||
is ConeTypeVariableType -> ConeTypeVariableType(nullability, lookupTag, attributes)
|
||||
is ConeTypeVariableType -> ConeTypeVariableType(nullability, typeConstructor, attributes)
|
||||
is ConeCapturedType -> ConeCapturedType(
|
||||
captureStatus, lowerType, nullability, constructor, attributes, isProjectionNotNull,
|
||||
)
|
||||
@@ -285,7 +285,7 @@ fun <T : ConeKotlinType> T.withNullability(
|
||||
)
|
||||
}
|
||||
|
||||
is ConeTypeVariableType -> ConeTypeVariableType(nullability, lookupTag, theAttributes)
|
||||
is ConeTypeVariableType -> ConeTypeVariableType(nullability, typeConstructor, theAttributes)
|
||||
is ConeCapturedType -> ConeCapturedType(captureStatus, lowerType, nullability, constructor, theAttributes)
|
||||
is ConeIntersectionType -> when (nullability) {
|
||||
ConeNullability.NULLABLE -> this.mapTypes {
|
||||
|
||||
@@ -353,7 +353,7 @@ private fun checkApplicabilityForArgumentType(
|
||||
|
||||
fun tryGetConeTypeThatCompatibleWithKtType(type: ConeKotlinType): ConeKotlinType {
|
||||
if (type is ConeTypeVariableType) {
|
||||
val lookupTag = type.lookupTag
|
||||
val lookupTag = type.typeConstructor
|
||||
|
||||
val constraints = csBuilder.currentStorage().notFixedTypeVariables[lookupTag]?.constraints
|
||||
val constraintTypes = constraints?.mapNotNull { it.type as? ConeKotlinType }
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ internal object CheckCallableReferenceExpectedType : CheckerStage() {
|
||||
val position = ConeArgumentConstraintPosition(callInfo.callSite)
|
||||
|
||||
if (expectedType != null && !resultingType.contains {
|
||||
it is ConeTypeVariableType && it.lookupTag !in outerCsBuilder.currentStorage().allTypeVariables
|
||||
it is ConeTypeVariableType && it.typeConstructor !in outerCsBuilder.currentStorage().allTypeVariables
|
||||
}
|
||||
) {
|
||||
addSubtypeConstraint(resultingType, expectedType, position)
|
||||
|
||||
+1
-1
@@ -449,7 +449,7 @@ open class FirDeclarationsResolveTransformer(
|
||||
// Substitut type parameter to type variable
|
||||
.let(candidate.substitutor::substituteOrSelf)
|
||||
.unwrapTopLevelVariableType() ?: return null
|
||||
val typeVariable = returnTypeBasedOnVariable.lookupTag
|
||||
val typeVariable = returnTypeBasedOnVariable.typeConstructor
|
||||
|
||||
val candidateSystem = candidate.system
|
||||
val candidateStorage = candidateSystem.currentStorage()
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ private class TypeVariableTypeRemovingSubstitutor(typeContext: ConeTypeContext)
|
||||
}
|
||||
|
||||
private fun convertTypeVariableType(type: ConeTypeVariableType): ConeKotlinType {
|
||||
val originalTypeParameter = type.lookupTag.originalTypeParameter
|
||||
val originalTypeParameter = type.typeConstructor.originalTypeParameter
|
||||
if (originalTypeParameter != null) {
|
||||
check(originalTypeParameter is ConeTypeParameterLookupTag)
|
||||
return ConeTypeParameterTypeImpl(originalTypeParameter, type.isNullable, type.attributes)
|
||||
|
||||
@@ -43,7 +43,7 @@ class ConeCannotInferReceiverParameterType(
|
||||
|
||||
class ConeTypeVariableTypeIsNotInferred(
|
||||
val typeVariableType: ConeTypeVariableType,
|
||||
override val reason: String = "Type for ${typeVariableType.lookupTag.debugName} is not inferred"
|
||||
override val reason: String = "Type for ${typeVariableType.typeConstructor.debugName} is not inferred"
|
||||
) : ConeDiagnostic
|
||||
|
||||
class ConeUnderscoreUsageWithoutBackticks(source: KtSourceElement) : ConeDiagnosticWithSource(source) {
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.fir.types.*
|
||||
fun ConeKotlinType.renderForDebugInfo(): String {
|
||||
val nullabilitySuffix = if (this !is ConeErrorType && this !is ConeErrorType) nullability.suffix else ""
|
||||
return when (this) {
|
||||
is ConeTypeVariableType -> "TypeVariable(${this.lookupTag.name})"
|
||||
is ConeTypeVariableType -> "TypeVariable(${this.typeConstructor.name})"
|
||||
is ConeDefinitelyNotNullType -> "${original.renderForDebugInfo()}!!"
|
||||
is ConeErrorType -> "ERROR CLASS: ${diagnostic.reason}"
|
||||
is ConeCapturedType -> "CapturedType(${constructor.projection.renderForDebugInfo()})"
|
||||
|
||||
Reference in New Issue
Block a user