FIR: fix declaration phase updating in FirContractResolveTransformer

This commit is contained in:
Ilya Kirillov
2021-03-03 20:45:31 +01:00
parent 4dc040b91a
commit f8828abeba
3 changed files with 7 additions and 7 deletions
@@ -84,7 +84,7 @@ abstract class FirAbstractBodyResolveTransformer(phase: FirResolvePhase) : FirAb
protected open fun needReplacePhase(firDeclaration: FirDeclaration) = true protected open fun needReplacePhase(firDeclaration: FirDeclaration) = true
fun replaceDeclarationResolvePhaseIfNeeded(firDeclaration: FirDeclaration, newResolvePhase: FirResolvePhase) { fun replaceDeclarationResolvePhaseIfNeeded(firDeclaration: FirDeclaration, newResolvePhase: FirResolvePhase) {
if (needReplacePhase(firDeclaration)) { if (needReplacePhase(firDeclaration) && newResolvePhase > firDeclaration.resolvePhase) {
firDeclaration.replaceResolvePhase(newResolvePhase) firDeclaration.replaceResolvePhase(newResolvePhase)
} }
} }
@@ -280,7 +280,7 @@ open class FirContractResolveTransformer(
get() = contractDescription is FirLegacyRawContractDescription || contractDescription is FirRawContractDescription get() = contractDescription is FirLegacyRawContractDescription || contractDescription is FirRawContractDescription
private fun FirDeclaration.updatePhase() { private fun FirDeclaration.updatePhase() {
replaceDeclarationResolvePhaseIfNeeded(this, FirResolvePhase.CONTRACTS) transformer.replaceDeclarationResolvePhaseIfNeeded(this, FirResolvePhase.CONTRACTS)
} }
} }
} }
@@ -1,6 +1,6 @@
FILE: classMembers.kt FILE: classMembers.kt
public final [CONTRACTS] class A : R|kotlin/Any| { public final [STATUS] class A : R|kotlin/Any| {
public [CONTRACTS] constructor(): R|A| { public [STATUS] constructor(): R|A| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -8,11 +8,11 @@ FILE: classMembers.kt
this@R|/A|.R|/A.receive|(this@R|/A|.R|/A.functionWithLazyBody|()) this@R|/A|.R|/A.receive|(this@R|/A|.R|/A.functionWithLazyBody|())
} }
public final [CONTRACTS] val x: R|kotlin/Int| = LAZY_EXPRESSION public final [STATUS] val x: R|kotlin/Int| = LAZY_EXPRESSION
[STATUS] public get(): R|kotlin/Int| { LAZY_BLOCK } [STATUS] public get(): R|kotlin/Int| { LAZY_BLOCK }
public final [CONTRACTS] fun receive([STATUS] value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK } public final [STATUS] fun receive([STATUS] value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
public final [CONTRACTS] fun functionWithLazyBody(): R|kotlin/String| { LAZY_BLOCK } public final [STATUS] fun functionWithLazyBody(): R|kotlin/String| { LAZY_BLOCK }
} }