FIR: Replace fir.bounds with resolvedBounds where it is appropriate
If there is a `coneType` call immediately after the `fir.bounds` call, it means that the fully resolved type is expected, hence `resolvedBounds` should be used
This commit is contained in:
@@ -136,7 +136,7 @@ private fun ConeTypeParameterLookupTag.findClassRepresentationThatIsSubtypeOf(
|
||||
supertype: ConeKotlinType,
|
||||
session: FirSession
|
||||
): ConeClassLikeLookupTag? =
|
||||
typeParameterSymbol.fir.bounds.map { it.coneType }.findClassRepresentationThatIsSubtypeOf(supertype, session)
|
||||
typeParameterSymbol.resolvedBounds.map { it.coneType }.findClassRepresentationThatIsSubtypeOf(supertype, session)
|
||||
|
||||
private fun Collection<ConeKotlinType>.findClassRepresentationThatIsSubtypeOf(
|
||||
supertype: ConeKotlinType,
|
||||
|
||||
@@ -74,7 +74,7 @@ private fun ConeKotlinType.scope(useSiteSession: FirSession, scopeSession: Scope
|
||||
scopeSession.getOrBuild(symbol, TYPE_PARAMETER_SCOPE_KEY) {
|
||||
val intersectionType = ConeTypeIntersector.intersectTypes(
|
||||
useSiteSession.typeContext,
|
||||
symbol.fir.bounds.map { it.coneType }
|
||||
symbol.resolvedBounds.map { it.coneType }
|
||||
)
|
||||
intersectionType.scope(useSiteSession, scopeSession, requiredPhase) ?: FirTypeScope.Empty
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ fun createSubstitution(
|
||||
else /* StarProjection */ -> {
|
||||
ConeTypeIntersector.intersectTypes(
|
||||
session.typeContext,
|
||||
typeParameterSymbol.fir.bounds.map { it.coneType }
|
||||
typeParameterSymbol.resolvedBounds.map { it.coneType }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -503,7 +503,7 @@ object FirFakeOverrideGenerator {
|
||||
var wereChangesInTypeParameters = forceTypeParametersRecreation
|
||||
for ((newTypeParameter, oldTypeParameter) in newTypeParameters.zip(member.typeParameters)) {
|
||||
val original = oldTypeParameter.symbol.fir
|
||||
for (boundTypeRef in original.bounds) {
|
||||
for (boundTypeRef in original.symbol.resolvedBounds) {
|
||||
val typeForBound = boundTypeRef.coneType
|
||||
val substitutedBound = substitutor.substituteOrNull(typeForBound)
|
||||
if (substitutedBound != null) {
|
||||
|
||||
+3
-3
@@ -82,8 +82,8 @@ class FirStandardOverrideChecker(private val session: FirSession) : FirAbstractO
|
||||
|
||||
if (isEqualTypes(substitutedOverrideType, substitutedBaseType)) return true
|
||||
|
||||
return overrideTypeParameter.bounds.any { bound -> isEqualTypes(bound.coneType, substitutedBaseType, substitutor) } &&
|
||||
baseTypeParameter.bounds.any { bound -> isEqualTypes(bound.coneType, substitutedOverrideType, substitutor) }
|
||||
return overrideTypeParameter.symbol.resolvedBounds.any { bound -> isEqualTypes(bound.coneType, substitutedBaseType, substitutor) } &&
|
||||
baseTypeParameter.symbol.resolvedBounds.any { bound -> isEqualTypes(bound.coneType, substitutedOverrideType, substitutor) }
|
||||
}
|
||||
|
||||
private fun isCompatibleTypeParameters(
|
||||
@@ -94,7 +94,7 @@ class FirStandardOverrideChecker(private val session: FirSession) : FirAbstractO
|
||||
if (overrideCandidate.symbol == baseDeclaration.symbol) return true
|
||||
if (overrideCandidate !is FirTypeParameter || baseDeclaration !is FirTypeParameter) return false
|
||||
if (overrideCandidate.bounds.size != baseDeclaration.bounds.size) return false
|
||||
return overrideCandidate.bounds.zip(baseDeclaration.bounds)
|
||||
return overrideCandidate.symbol.resolvedBounds.zip(baseDeclaration.symbol.resolvedBounds)
|
||||
.all { (aBound, bBound) -> isEqualBound(aBound, bBound, overrideCandidate, baseDeclaration, substitutor) }
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ fun ConeKotlinType.findSubtypeOfNonSuspendFunctionalType(session: FirSession, ex
|
||||
intersectedTypes.find { it.findSubtypeOfNonSuspendFunctionalType(session, expectedFunctionalType) != null }
|
||||
}
|
||||
is ConeTypeParameterType -> {
|
||||
val bounds = lookupTag.typeParameterSymbol.fir.bounds.map { it.coneType }
|
||||
val bounds = lookupTag.typeParameterSymbol.resolvedBounds.map { it.coneType }
|
||||
if (bounds.any { it.isSuspendFunctionType(session) })
|
||||
null
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user