[LL API] Resolve properties called inside code fragments 'CodeFragmentCapturedValueAnalyzer' assumes the analyzed code fragment is then passed to the backend. For property calls, there are several code generation strategies (field, accessor, delegate). In order to be able to choose one, the whole property, including its possibly 'const' initializer, must be resolved. The commit fixes a plenty of 'FirIdeNormalAnalysisSourceModuleCompilerF\ acilityTestGenerated.CodeFragments.Capturing' tests that broke after the 'FirExpression.type' refactoring.
diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/compile/CodeFragmentCapturedValueAnalyzer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/compile/CodeFragmentCapturedValueAnalyzer.kt index 71836cc..81f0778 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/compile/CodeFragmentCapturedValueAnalyzer.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/compile/CodeFragmentCapturedValueAnalyzer.kt
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.fir.resolve.defaultType import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.* +import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef @@ -183,6 +184,9 @@ else -> CodeFragmentCapturedValue.Local(symbol.name, symbol.isMutated, isCrossingInlineBounds) } register(symbol, CodeFragmentCapturedSymbol(capturedValue, symbol, symbol.resolvedReturnTypeRef)) + } else { + // Property call generation depends on complete backing field resolution (Fir2IrLazyProperty.backingField) + symbol.lazyResolveToPhase(FirResolvePhase.BODY_RESOLVE) } } is FirBackingFieldSymbol -> {