[FIR] Get rid of ReturnTypeCalculator in ScopeSession
This commit is contained in:
+1
-3
@@ -37,9 +37,7 @@ class FirImplicitTypeBodyResolveProcessor(
|
||||
@AdapterForResolveProcessor
|
||||
class FirImplicitTypeBodyResolveTransformerAdapter(session: FirSession, scopeSession: ScopeSession) : FirTransformer<Nothing?>() {
|
||||
private val implicitBodyResolveComputationSession = ImplicitBodyResolveComputationSession()
|
||||
private val returnTypeCalculator = ReturnTypeCalculatorWithJump(session, scopeSession, implicitBodyResolveComputationSession).also {
|
||||
scopeSession.returnTypeCalculator = it
|
||||
}
|
||||
private val returnTypeCalculator = ReturnTypeCalculatorWithJump(session, scopeSession, implicitBodyResolveComputationSession)
|
||||
|
||||
private val transformer = FirImplicitAwareBodyResolveTransformer(
|
||||
session,
|
||||
|
||||
+3
-6
@@ -119,9 +119,6 @@ class FirClassSubstitutionScope(
|
||||
}
|
||||
}
|
||||
|
||||
private val typeCalculator =
|
||||
(scopeSession.returnTypeCalculator as ReturnTypeCalculator?) ?: ReturnTypeCalculatorForFullBodyResolve()
|
||||
|
||||
private fun ConeKotlinType.substitute(): ConeKotlinType? {
|
||||
return substitutor.substituteOrNull(this)
|
||||
}
|
||||
@@ -227,7 +224,7 @@ class FirClassSubstitutionScope(
|
||||
val receiverType = member.receiverTypeRef?.coneType
|
||||
val newReceiverType = receiverType?.substitute(substitutor)
|
||||
|
||||
val returnType = typeCalculator.tryCalculateReturnType(member).type
|
||||
val returnType = member.returnTypeRef.coneType
|
||||
val newReturnType = returnType.substitute(substitutor)
|
||||
return SubstitutedData(newTypeParameters, newReceiverType, newReturnType, substitutor)
|
||||
}
|
||||
@@ -237,7 +234,7 @@ class FirClassSubstitutionScope(
|
||||
val member = original.fir
|
||||
if (skipPrivateMembers && member.visibility == Visibilities.Private) return original
|
||||
|
||||
val returnType = typeCalculator.tryCalculateReturnType(member).type
|
||||
val returnType = member.returnTypeRef.coneType
|
||||
val newReturnType = returnType.substitute() ?: return original
|
||||
|
||||
return createFakeOverrideField(session, member, original, newReturnType, derivedClassId)
|
||||
@@ -248,7 +245,7 @@ class FirClassSubstitutionScope(
|
||||
val member = original.fir as FirSyntheticProperty
|
||||
if (skipPrivateMembers && member.visibility == Visibilities.Private) return original
|
||||
|
||||
val returnType = typeCalculator.tryCalculateReturnType(member).type
|
||||
val returnType = member.returnTypeRef.coneType
|
||||
val newReturnType = returnType.substitute()
|
||||
|
||||
val newParameterTypes = member.getter.valueParameters.map {
|
||||
|
||||
@@ -10,8 +10,6 @@ import org.jetbrains.kotlin.fir.PrivateForInline
|
||||
class ScopeSession {
|
||||
private val scopes = hashMapOf<Any, HashMap<ScopeSessionKey<*, *>, Any>>()
|
||||
|
||||
var returnTypeCalculator: Any? = null
|
||||
|
||||
@PrivateForInline
|
||||
fun scopes() = scopes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user