[K2] Resolve bodies of const properties during IMPLICIT_TYPES_BODY_RESOLVE

This is required to implement constant evaluator on the FIR level.

#KT-64151
This commit is contained in:
Ivan Kylchik
2024-01-25 14:50:32 +01:00
committed by Space Team
parent 0ebf2862a9
commit 61fabc02ba
9 changed files with 58 additions and 34 deletions
@@ -172,6 +172,8 @@ enum class FirResolvePhase(val noProcessor: Boolean = false) {
* val baz get() = foo() // implicit type is Int
* ```
*
* Also resolve initializers of const properties.
*
* This is a [*jumping phase*][FirResolvePhase].
*
* @see TYPES
@@ -180,6 +182,12 @@ enum class FirResolvePhase(val noProcessor: Boolean = false) {
/**
* The compiler evaluates expressions that are used as initializers for const properties and defaults of annotation's constructor.
*
* This phase has two reasons to exist as a separate phase:
* 1. It is a synchronization point.
* Compiler visits this phase only when all const properties are resolved.
* This is especially useful when evaluating const properties from the Java world.
* 2. The Analysis API can get results of constant evaluation before [BODY_RESOLVE] phase.
*/
CONSTANT_EVALUATION,