diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt index 0ffe3c50a01..52db4dc41f5 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt @@ -340,9 +340,7 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM } override fun visitDeclaration(declaration: FirDeclaration) { - if (mode.renderDeclarationResolvePhase) { - print("[${declaration.resolvePhase}] ") - } + declaration.renderPhaseIfNeeded() print( when (declaration) { is FirRegularClass -> declaration.classKind.name.toLowerCase().replace("_", " ") @@ -359,6 +357,12 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM ) } + private fun FirDeclaration.renderPhaseIfNeeded() { + if (mode.renderDeclarationResolvePhase) { + print("[${resolvePhase}] ") + } + } + private fun List.renderDeclarations() { renderInBraces { for (declaration in this) { @@ -458,6 +462,7 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM if (constructor.isActual) { print("actual ") } + constructor.renderPhaseIfNeeded() print("constructor") constructor.typeParameters.renderTypeParameters() constructor.valueParameters.renderParameters() diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/classMembers.txt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/classMembers.txt index 66d679d219d..7f1aa7d23ce 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/classMembers.txt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/classMembers.txt @@ -1,6 +1,6 @@ FILE: classMembers.kt public final [BODY_RESOLVE] class A : R|kotlin/Any| { - public constructor(): R|A| { + public [CONTRACTS] constructor(): R|A| { super() } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/delegates.txt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/delegates.txt index 5cff929d20e..54e11b255ca 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/delegates.txt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/delegates.txt @@ -7,7 +7,7 @@ FILE: delegates.kt } public final [STATUS] fun receive(value: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK } public final [IMPLICIT_TYPES_BODY_RESOLVE] val delegate: R|kotlin/properties/ReadWriteProperty| = object : R|kotlin/properties/ReadWriteProperty| { - private constructor(): R|| { + private [BODY_RESOLVE] constructor(): R|| { super() } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/secondaryConstructor.txt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/secondaryConstructor.txt index 5684066099f..47e22d827ab 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/secondaryConstructor.txt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/secondaryConstructor.txt @@ -4,6 +4,6 @@ FILE: secondaryConstructor.kt } public final [STATUS] fun receive(value: R|A|): R|kotlin/Unit| { LAZY_BLOCK } public final [STATUS] class A : R|kotlin/Any| { - public constructor(x: R|kotlin/Int|): R|A| { LAZY_BLOCK } + public [STATUS] constructor(x: R|kotlin/Int|): R|A| { LAZY_BLOCK } } diff --git a/idea/testData/fir/lazyResolve/elvis/main.txt b/idea/testData/fir/lazyResolve/elvis/main.txt index a044e0f0df3..603360ad5e7 100644 --- a/idea/testData/fir/lazyResolve/elvis/main.txt +++ b/idea/testData/fir/lazyResolve/elvis/main.txt @@ -1,6 +1,6 @@ FILE: main.kt public final [BODY_RESOLVE] class WithElvis : R|kotlin/Any| { - public constructor(value: R|kotlin/String?|): R|elvis/WithElvis| { + public [CONTRACTS] constructor(value: R|kotlin/String?|): R|elvis/WithElvis| { super() } diff --git a/idea/testData/fir/lazyResolve/inInit/main.txt b/idea/testData/fir/lazyResolve/inInit/main.txt index f22840a6425..02321541b3e 100644 --- a/idea/testData/fir/lazyResolve/inInit/main.txt +++ b/idea/testData/fir/lazyResolve/inInit/main.txt @@ -1,6 +1,6 @@ FILE: main.kt public final [BODY_RESOLVE] class Foo : R|kotlin/Any| { - public constructor(): R|Foo| { + public [BODY_RESOLVE] constructor(): R|Foo| { super() } diff --git a/idea/testData/fir/lazyResolve/inSecondary/main.txt b/idea/testData/fir/lazyResolve/inSecondary/main.txt index 1d7a239ddf9..1af0f1fbe87 100644 --- a/idea/testData/fir/lazyResolve/inSecondary/main.txt +++ b/idea/testData/fir/lazyResolve/inSecondary/main.txt @@ -3,7 +3,7 @@ FILE: main.kt public final [CONTRACTS] val x: R|kotlin/Int| public get(): R|kotlin/Int| - public constructor(): R|Foo| { + public [BODY_RESOLVE] constructor(): R|Foo| { super() this@R|/Foo|.R|/Foo.x| = Int(42) } diff --git a/idea/testData/fir/lazyResolve/secondary/main.txt b/idea/testData/fir/lazyResolve/secondary/main.txt index 1b8de2ec511..cff06d08a32 100644 --- a/idea/testData/fir/lazyResolve/secondary/main.txt +++ b/idea/testData/fir/lazyResolve/secondary/main.txt @@ -1,6 +1,6 @@ FILE: main.kt public final [STATUS] class My : R|kotlin/Any| { - public constructor(): R|My| { + public [STATUS] constructor(): R|My| { super() }