[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.
This commit is contained in:
Yan Zhulanow
2023-08-11 18:17:58 +09:00
committed by Space Team
parent 7fde5af7f8
commit d70dbbc4cf
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.fir.references.toResolvedCallableSymbol
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
@@ -188,6 +189,9 @@ private class CodeFragmentCapturedValueVisitor(
else -> CodeFragmentCapturedValue.Local(symbol.name, symbol.isMutated, isCrossingInlineBounds)
}
register(CodeFragmentCapturedSymbol(capturedValue, symbol, symbol.resolvedReturnTypeRef))
} else {
// Property call generation depends on complete backing field resolution (Fir2IrLazyProperty.backingField)
symbol.lazyResolveToPhase(FirResolvePhase.BODY_RESOLVE)
}
}
is FirBackingFieldSymbol -> {