[LL FIR] LLFirContractsLazyResolver: process synthetic properties correctly
FirContractResolveTransformer under the hood calls
```
if (property is FirSyntheticProperty) {
transformSimpleFunction(property.getter.delegate, data)
}
```,
so this leads to unsafe transformation of the original function
^KT-55750
This commit is contained in:
committed by
Space Team
parent
2962482d75
commit
d5047bfa90
+16
@@ -17,9 +17,11 @@ import org.jetbrains.kotlin.fir.FirFileAnnotationsContainer
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.contracts.FirRawContractDescription
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty
|
||||
import org.jetbrains.kotlin.fir.resolve.ScopeSession
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirResolveContextCollector
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.contracts.FirContractResolveTransformer
|
||||
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
||||
import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef
|
||||
|
||||
internal object LLFirContractsLazyResolver : LLFirLazyResolver(FirResolvePhase.CONTRACTS) {
|
||||
@@ -53,6 +55,20 @@ private class LLFirContractsTargetResolver(
|
||||
) {
|
||||
override val transformer = FirContractResolveTransformer(session, scopeSession)
|
||||
|
||||
override fun doResolveWithoutLock(target: FirElementWithResolveState): Boolean {
|
||||
if (target is FirSyntheticProperty) {
|
||||
target.getter.delegate.lazyResolveToPhase(resolverPhase)
|
||||
|
||||
performCustomResolveUnderLock(target) {
|
||||
// just update phase
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
return super.doResolveWithoutLock(target)
|
||||
}
|
||||
|
||||
override fun doLazyResolveUnderLock(target: FirElementWithResolveState) {
|
||||
when (target) {
|
||||
is FirSimpleFunction -> {
|
||||
|
||||
Reference in New Issue
Block a user