Fix leak of BodyResolveTransformer due to inference components capture
This commit is contained in:
committed by
Mikhail Glukhikh
parent
146a53f18c
commit
3aadf58354
+20
-16
@@ -239,23 +239,7 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val inferenceComponents = InferenceComponents(object : ConeInferenceContext, TypeSystemInferenceExtensionContextDelegate {
|
|
||||||
override fun findCommonIntegerLiteralTypesSuperType(explicitSupertypes: List<SimpleTypeMarker>): SimpleTypeMarker? {
|
|
||||||
//TODO wtf
|
|
||||||
return explicitSupertypes.firstOrNull()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun TypeConstructorMarker.getApproximatedIntegerLiteralType(): KotlinTypeMarker {
|
|
||||||
TODO("not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
override val session: FirSession
|
|
||||||
get() = this@FirBodyResolveTransformer.session
|
|
||||||
|
|
||||||
override fun KotlinTypeMarker.removeExactAnnotation(): KotlinTypeMarker {
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
}, session, jump)
|
|
||||||
|
|
||||||
private var qualifierStack = mutableListOf<Name>()
|
private var qualifierStack = mutableListOf<Name>()
|
||||||
private var qualifierPartsToDrop = 0
|
private var qualifierPartsToDrop = 0
|
||||||
@@ -522,6 +506,7 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val noExpectedType = FirImplicitTypeRefImpl(session, null)
|
private val noExpectedType = FirImplicitTypeRefImpl(session, null)
|
||||||
|
private val inferenceComponents = inferenceComponents(session, jump)
|
||||||
|
|
||||||
private fun resolveCallAndSelectCandidate(functionCall: FirFunctionCall, expectedTypeRef: FirTypeRef?): FirFunctionCall {
|
private fun resolveCallAndSelectCandidate(functionCall: FirFunctionCall, expectedTypeRef: FirTypeRef?): FirFunctionCall {
|
||||||
|
|
||||||
@@ -999,6 +984,25 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun inferenceComponents(session: FirSession, jump: ReturnTypeCalculatorWithJump) =
|
||||||
|
InferenceComponents(object : ConeInferenceContext, TypeSystemInferenceExtensionContextDelegate {
|
||||||
|
override fun findCommonIntegerLiteralTypesSuperType(explicitSupertypes: List<SimpleTypeMarker>): SimpleTypeMarker? {
|
||||||
|
//TODO wtf
|
||||||
|
return explicitSupertypes.firstOrNull()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun TypeConstructorMarker.getApproximatedIntegerLiteralType(): KotlinTypeMarker {
|
||||||
|
TODO("not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override val session: FirSession
|
||||||
|
get() = session
|
||||||
|
|
||||||
|
override fun KotlinTypeMarker.removeExactAnnotation(): KotlinTypeMarker {
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
}, session, jump)
|
||||||
|
|
||||||
|
|
||||||
class ReturnTypeCalculatorWithJump(val session: FirSession) : ReturnTypeCalculator {
|
class ReturnTypeCalculatorWithJump(val session: FirSession) : ReturnTypeCalculator {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user