[FIR] Make annotations arguments lazy in RawFirBuilder
Sixth step for ^KT-52615
This commit is contained in:
+118
-5
@@ -9,23 +9,30 @@ import kotlinx.collections.immutable.PersistentList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.collections.immutable.toPersistentList
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignation
|
||||
import org.jetbrains.kotlin.fir.FirElement
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.getExplicitBackingField
|
||||
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirStatement
|
||||
import org.jetbrains.kotlin.fir.expressions.FirWrappedDelegateExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirLazyBlock
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirLazyDelegatedConstructorCall
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirLazyExpression
|
||||
import org.jetbrains.kotlin.fir.psi
|
||||
import org.jetbrains.kotlin.fir.extensions.registeredPluginAnnotations
|
||||
import org.jetbrains.kotlin.fir.scopes.kotlinScopeProvider
|
||||
import org.jetbrains.kotlin.fir.types.FirUserTypeRef
|
||||
import org.jetbrains.kotlin.fir.visitors.FirTransformer
|
||||
import org.jetbrains.kotlin.fir.visitors.transformSingle
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.name.StandardClassIds.Annotations.Deprecated
|
||||
import org.jetbrains.kotlin.name.StandardClassIds.Annotations.DeprecatedSinceKotlin
|
||||
import org.jetbrains.kotlin.name.StandardClassIds.Annotations.JvmRecord
|
||||
import org.jetbrains.kotlin.name.StandardClassIds.Annotations.WasExperimental
|
||||
import org.jetbrains.kotlin.name.StandardClassIds.Annotations.SinceKotlin
|
||||
|
||||
internal object FirLazyBodiesCalculator {
|
||||
fun calculateLazyBodiesInside(designation: FirDesignation) {
|
||||
calculateAnnotations(designation.target)
|
||||
designation.target.transform<FirElement, PersistentList<FirRegularClass>>(
|
||||
FirLazyBodiesCalculatorTransformer,
|
||||
designation.path.toPersistentList(),
|
||||
@@ -33,9 +40,28 @@ internal object FirLazyBodiesCalculator {
|
||||
}
|
||||
|
||||
fun calculateLazyBodies(firFile: FirFile) {
|
||||
calculateAnnotations(firFile)
|
||||
firFile.transform<FirElement, PersistentList<FirRegularClass>>(FirLazyBodiesCalculatorTransformer, persistentListOf())
|
||||
}
|
||||
|
||||
fun calculateAnnotations(firElement: FirElementWithResolvePhase) {
|
||||
calculateAnnotations(firElement, firElement.moduleData.session)
|
||||
}
|
||||
|
||||
fun calculateAnnotations(firElement: FirElement, session: FirSession) {
|
||||
firElement.transform<FirElement, FirLazyAnnotationTransformerData>(
|
||||
FirLazyAnnotationTransformer,
|
||||
FirLazyAnnotationTransformerData(session)
|
||||
)
|
||||
}
|
||||
|
||||
fun calculateCompilerAnnotations(firElement: FirElementWithResolvePhase) {
|
||||
firElement.transform<FirElement, FirLazyAnnotationTransformerData>(
|
||||
FirLazyAnnotationTransformer,
|
||||
FirLazyAnnotationTransformerData(firElement.moduleData.session, FirLazyAnnotationTransformerScope.COMPILER_ONLY)
|
||||
)
|
||||
}
|
||||
|
||||
private fun replaceValueParameterDefaultValues(valueParameters: List<FirValueParameter>, newValueParameters: List<FirValueParameter>) {
|
||||
require(valueParameters.size == newValueParameters.size)
|
||||
for ((valueParameter, newValueParameter) in valueParameters.zip(newValueParameters)) {
|
||||
@@ -45,6 +71,13 @@ internal object FirLazyBodiesCalculator {
|
||||
}
|
||||
}
|
||||
|
||||
fun calculateLazyArgumentsForAnnotation(annotationCall: FirAnnotationCall, session: FirSession) {
|
||||
require(needCalculatingAnnotationCall(annotationCall))
|
||||
val builder = RawFirBuilder(session, baseScopeProvider = session.kotlinScopeProvider)
|
||||
val newAnnotationCall = builder.buildAnnotationCall(annotationCall.psi as KtAnnotationEntry)
|
||||
annotationCall.replaceArgumentList(newAnnotationCall.argumentList)
|
||||
}
|
||||
|
||||
fun calculateLazyBodiesForFunction(designation: FirDesignation) {
|
||||
val simpleFunction = designation.target as FirSimpleFunction
|
||||
require(needCalculatingLazyBodyForFunction(simpleFunction))
|
||||
@@ -169,6 +202,86 @@ internal object FirLazyBodiesCalculator {
|
||||
|| firProperty.initializer is FirLazyExpression
|
||||
|| (firProperty.delegate as? FirWrappedDelegateExpression)?.expression is FirLazyExpression
|
||||
|| firProperty.getExplicitBackingField()?.initializer is FirLazyExpression
|
||||
|
||||
fun needCalculatingAnnotationCall(firAnnotationCall: FirAnnotationCall): Boolean =
|
||||
firAnnotationCall.argumentList.arguments.any { it is FirLazyExpression }
|
||||
}
|
||||
|
||||
private enum class FirLazyAnnotationTransformerScope {
|
||||
ALL_ANNOTATIONS,
|
||||
COMPILER_ONLY;
|
||||
}
|
||||
|
||||
private data class FirLazyAnnotationTransformerData(
|
||||
val session: FirSession,
|
||||
val compilerAnnotationsOnly: FirLazyAnnotationTransformerScope = FirLazyAnnotationTransformerScope.ALL_ANNOTATIONS
|
||||
)
|
||||
|
||||
private object FirLazyAnnotationTransformer : FirTransformer<FirLazyAnnotationTransformerData>() {
|
||||
private val COMPILATOR_ANNOTATION_NAMES: Set<Name> = setOf(
|
||||
Deprecated,
|
||||
DeprecatedSinceKotlin,
|
||||
WasExperimental,
|
||||
JvmRecord,
|
||||
SinceKotlin,
|
||||
).mapTo(mutableSetOf()) { it.shortClassName }
|
||||
|
||||
private fun canBeCompilerAnnotation(annotationCall: FirAnnotationCall, session: FirSession): Boolean {
|
||||
val annotationTypeRef = annotationCall.annotationTypeRef
|
||||
if (annotationTypeRef !is FirUserTypeRef) return false
|
||||
if (session.registeredPluginAnnotations.annotations.isNotEmpty()) return true
|
||||
val name = annotationTypeRef.qualifier.last().name
|
||||
return name in COMPILATOR_ANNOTATION_NAMES
|
||||
}
|
||||
|
||||
override fun <E : FirElement> transformElement(element: E, data: FirLazyAnnotationTransformerData): E {
|
||||
element.transformChildren(this, data)
|
||||
return element
|
||||
}
|
||||
|
||||
override fun transformAnnotationCall(annotationCall: FirAnnotationCall, data: FirLazyAnnotationTransformerData): FirStatement {
|
||||
if ((data.compilerAnnotationsOnly == FirLazyAnnotationTransformerScope.ALL_ANNOTATIONS || canBeCompilerAnnotation(
|
||||
annotationCall,
|
||||
data.session,
|
||||
)) && FirLazyBodiesCalculator.needCalculatingAnnotationCall(annotationCall)
|
||||
) {
|
||||
FirLazyBodiesCalculator.calculateLazyArgumentsForAnnotation(annotationCall, data.session)
|
||||
}
|
||||
super.transformAnnotationCall(annotationCall, data)
|
||||
return annotationCall
|
||||
}
|
||||
|
||||
override fun transformErrorAnnotationCall(
|
||||
errorAnnotationCall: FirErrorAnnotationCall,
|
||||
data: FirLazyAnnotationTransformerData
|
||||
): FirStatement {
|
||||
transformAnnotationCall(errorAnnotationCall, data)
|
||||
return errorAnnotationCall
|
||||
}
|
||||
|
||||
override fun transformExpression(expression: FirExpression, data: FirLazyAnnotationTransformerData): FirStatement {
|
||||
if (expression is FirLazyExpression) {
|
||||
return expression
|
||||
}
|
||||
return super.transformExpression(expression, data)
|
||||
}
|
||||
|
||||
override fun transformBlock(block: FirBlock, data: FirLazyAnnotationTransformerData): FirStatement {
|
||||
if (block is FirLazyBlock) {
|
||||
return block
|
||||
}
|
||||
return super.transformBlock(block, data)
|
||||
}
|
||||
|
||||
override fun transformDelegatedConstructorCall(
|
||||
delegatedConstructorCall: FirDelegatedConstructorCall,
|
||||
data: FirLazyAnnotationTransformerData
|
||||
): FirStatement {
|
||||
if (delegatedConstructorCall is FirLazyDelegatedConstructorCall) {
|
||||
return delegatedConstructorCall
|
||||
}
|
||||
return super.transformDelegatedConstructorCall(delegatedConstructorCall, data)
|
||||
}
|
||||
}
|
||||
|
||||
private object FirLazyBodiesCalculatorTransformer : FirTransformer<PersistentList<FirRegularClass>>() {
|
||||
|
||||
+2
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers
|
||||
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirPhaseRunner
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirLazyTransformer.Companion.updatePhaseDeep
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkAnnotationArgumentsMappingIsResolved
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase
|
||||
@@ -41,6 +42,7 @@ internal class LLFirDesignatedAnnotationArgumentsMappingTransformer(
|
||||
designation.target.checkPhase(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE)
|
||||
|
||||
phaseRunner.runPhaseWithCustomResolve(FirResolvePhase.ANNOTATIONS_ARGUMENTS_MAPPING) {
|
||||
FirLazyBodiesCalculator.calculateAnnotations(designation.firFile)
|
||||
designation.firFile.transform<FirFile, ResolutionMode>(this, ResolutionMode.ContextIndependent)
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers
|
||||
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirPhaseRunner
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkTypeRefIsResolved
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withFirEntry
|
||||
@@ -27,6 +28,7 @@ internal class LLFirDesignatedAnnotationArgumentsResolveTransformer(
|
||||
|
||||
private fun moveNextDeclaration(designationIterator: Iterator<FirElementWithResolvePhase>) {
|
||||
if (!designationIterator.hasNext()) {
|
||||
FirLazyBodiesCalculator.calculateAnnotations(designation.target)
|
||||
designation.target.transform<FirDeclaration, ResolutionMode>(declarationsTransformer, ResolutionMode.ContextIndependent)
|
||||
return
|
||||
}
|
||||
|
||||
+2
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers
|
||||
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirPhaseRunner
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase
|
||||
import org.jetbrains.kotlin.fir.FirElementWithResolvePhase
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
@@ -25,6 +26,7 @@ internal class LLFirDesignatedAnnotationsResolveTransformed(
|
||||
if (!designationIterator.hasNext()) {
|
||||
val declaration = designation.target
|
||||
if (declaration is FirRegularClass || declaration is FirTypeAlias) {
|
||||
FirLazyBodiesCalculator.calculateCompilerAnnotations(declaration)
|
||||
declaration.transform<FirDeclaration, Nothing?>(this, null)
|
||||
}
|
||||
return
|
||||
|
||||
+8
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers
|
||||
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirPhaseRunner
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirLazyTransformer.Companion.updatePhaseDeep
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.*
|
||||
import org.jetbrains.kotlin.fir.FirElement
|
||||
@@ -15,6 +16,8 @@ import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.resolve.ScopeSession
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.FirTypeResolveTransformer
|
||||
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
|
||||
/**
|
||||
* Transform designation into TYPES phase. Affects only for designation, target declaration and it's children
|
||||
@@ -53,6 +56,11 @@ internal class LLFirDesignatedTypeResolverTransformer(
|
||||
(designation.target as? FirDeclaration)?.let { checkClassMembersAreResolved(it) }
|
||||
}
|
||||
|
||||
override fun transformTypeRef(typeRef: FirTypeRef, data: Any?): FirResolvedTypeRef {
|
||||
FirLazyBodiesCalculator.calculateAnnotations(typeRef, session)
|
||||
return super.transformTypeRef(typeRef, data)
|
||||
}
|
||||
|
||||
override fun checkIsResolved(target: FirElementWithResolvePhase) {
|
||||
target.checkPhase(FirResolvePhase.TYPES)
|
||||
when (target) {
|
||||
|
||||
@@ -31,9 +31,9 @@ FILE: annotationParameters.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@Anno(X#.A#) public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@Anno(LAZY_EXPRESSION) public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
@Anno(X#.A#) public? final? [RAW_FIR] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@Anno(LAZY_EXPRESSION) public? final? [RAW_FIR] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -69,9 +69,9 @@ FILE: annotationParameters.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@Anno(X#.A#) public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@Anno(LAZY_EXPRESSION) public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
@Anno(X#.A#) public? final? [RAW_FIR] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@Anno(LAZY_EXPRESSION) public? final? [RAW_FIR] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -107,9 +107,9 @@ FILE: annotationParameters.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@Anno(X#.A#) public? final? [COMPILER_REQUIRED_ANNOTATIONS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@Anno(LAZY_EXPRESSION) public? final? [COMPILER_REQUIRED_ANNOTATIONS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
@Anno(X#.A#) public? final? [RAW_FIR] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@Anno(LAZY_EXPRESSION) public? final? [RAW_FIR] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -145,9 +145,9 @@ FILE: annotationParameters.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@Anno(X#.A#) public? final? [COMPANION_GENERATION] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@Anno(LAZY_EXPRESSION) public? final? [COMPANION_GENERATION] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
@Anno(X#.A#) public? final? [RAW_FIR] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@Anno(LAZY_EXPRESSION) public? final? [RAW_FIR] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -183,9 +183,9 @@ FILE: annotationParameters.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@Anno(X#.A#) public? final? [SUPER_TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@Anno(LAZY_EXPRESSION) public? final? [SUPER_TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
@Anno(X#.A#) public? final? [RAW_FIR] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@Anno(LAZY_EXPRESSION) public? final? [RAW_FIR] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -221,9 +221,9 @@ FILE: annotationParameters.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@R|Anno|(X#.A#) public? final? [TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@R|Anno|(LAZY_EXPRESSION) public? final? [TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
@Anno(X#.A#) public? final? [SUPER_TYPES] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@Anno(LAZY_EXPRESSION) public? final? [SUPER_TYPES] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -259,9 +259,9 @@ FILE: annotationParameters.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@R|Anno|(X#.A#) public final [STATUS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@R|Anno|(LAZY_EXPRESSION) public final [STATUS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
@R|Anno|(X#.A#) public final [TYPES] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@R|Anno|(LAZY_EXPRESSION) public final [TYPES] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ FILE: annotationParameters.kt
|
||||
|
||||
@R|Anno|(Q|X|.R|/X.A|) public final [ARGUMENTS_OF_ANNOTATIONS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
@R|Anno|(X#.A#) public final [STATUS] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@R|Anno|(LAZY_EXPRESSION) public final [STATUS] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ FILE: annotationParameters.kt
|
||||
@R|Anno|(Q|X|.R|/X.A|) public final [CONTRACTS] fun resolveMe(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
@R|Anno|(X#.A#) public final [STATUS] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@R|Anno|(LAZY_EXPRESSION) public final [STATUS] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ FILE: annotationParameters.kt
|
||||
@R|Anno|(Q|X|.R|/X.A|) public final [IMPLICIT_TYPES_BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
@R|Anno|(X#.A#) public final [STATUS] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@R|Anno|(LAZY_EXPRESSION) public final [STATUS] fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
|
||||
+17
-17
@@ -1,53 +1,53 @@
|
||||
|
||||
RAW_FIR:
|
||||
FILE: annotations.kt
|
||||
@FILE:Suppress(String(1))
|
||||
@Suppress(String(2)) public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@FILE:Suppress(LAZY_EXPRESSION)
|
||||
@Suppress(LAZY_EXPRESSION) public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
IMPORTS:
|
||||
FILE: annotations.kt
|
||||
@FILE:Suppress(String(1))
|
||||
@Suppress(String(2)) public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@FILE:Suppress(LAZY_EXPRESSION)
|
||||
@Suppress(LAZY_EXPRESSION) public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
COMPILER_REQUIRED_ANNOTATIONS:
|
||||
FILE: annotations.kt
|
||||
@FILE:Suppress(String(1))
|
||||
@Suppress(String(2)) public? final? [COMPILER_REQUIRED_ANNOTATIONS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@FILE:Suppress(LAZY_EXPRESSION)
|
||||
@Suppress(LAZY_EXPRESSION) public? final? [COMPILER_REQUIRED_ANNOTATIONS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
COMPANION_GENERATION:
|
||||
FILE: annotations.kt
|
||||
@FILE:Suppress(String(1))
|
||||
@Suppress(String(2)) public? final? [COMPANION_GENERATION] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@FILE:Suppress(LAZY_EXPRESSION)
|
||||
@Suppress(LAZY_EXPRESSION) public? final? [COMPANION_GENERATION] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
SUPER_TYPES:
|
||||
FILE: annotations.kt
|
||||
@FILE:Suppress(String(1))
|
||||
@Suppress(String(2)) public? final? [SUPER_TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@FILE:Suppress(LAZY_EXPRESSION)
|
||||
@Suppress(LAZY_EXPRESSION) public? final? [SUPER_TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
TYPES:
|
||||
FILE: annotations.kt
|
||||
@FILE:Suppress(String(1))
|
||||
@R|kotlin/Suppress|(String(2)) public? final? [TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@FILE:Suppress(LAZY_EXPRESSION)
|
||||
@R|kotlin/Suppress|(LAZY_EXPRESSION) public? final? [TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
STATUS:
|
||||
FILE: annotations.kt
|
||||
@FILE:Suppress(String(1))
|
||||
@R|kotlin/Suppress|(String(2)) public final [STATUS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
@FILE:Suppress(LAZY_EXPRESSION)
|
||||
@R|kotlin/Suppress|(LAZY_EXPRESSION) public final [STATUS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
ARGUMENTS_OF_ANNOTATIONS:
|
||||
FILE: annotations.kt
|
||||
@FILE:Suppress(String(1))
|
||||
@FILE:Suppress(LAZY_EXPRESSION)
|
||||
@R|kotlin/Suppress|(String(2)) public final [ARGUMENTS_OF_ANNOTATIONS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
CONTRACTS:
|
||||
FILE: annotations.kt
|
||||
@FILE:Suppress(String(1))
|
||||
@FILE:Suppress(LAZY_EXPRESSION)
|
||||
@R|kotlin/Suppress|(String(2)) public final [CONTRACTS] fun resolveMe(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
IMPLICIT_TYPES_BODY_RESOLVE:
|
||||
FILE: annotations.kt
|
||||
@FILE:Suppress(String(1))
|
||||
@FILE:Suppress(LAZY_EXPRESSION)
|
||||
@R|kotlin/Suppress|(String(2)) public final [IMPLICIT_TYPES_BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,10 @@ open class RawFirBuilder(
|
||||
return file.accept(Visitor(), Unit) as FirFile
|
||||
}
|
||||
|
||||
fun buildAnnotationCall(annotation: KtAnnotationEntry): FirAnnotationCall {
|
||||
return Visitor().visitAnnotationEntry(annotation, Unit) as FirAnnotationCall
|
||||
}
|
||||
|
||||
fun buildTypeReference(reference: KtTypeReference): FirTypeRef {
|
||||
return reference.accept(Visitor(), Unit) as FirTypeRef
|
||||
}
|
||||
@@ -817,7 +821,8 @@ open class RawFirBuilder(
|
||||
val argumentList = buildArgumentList {
|
||||
source = valueArgumentList?.toFirSourceElement()
|
||||
for (argument in valueArguments) {
|
||||
val argumentExpression = disabledLazyMode { argument.toFirExpression() }
|
||||
val argumentExpression =
|
||||
buildOrLazyExpression((argument as? PsiElement)?.toFirSourceElement()) { argument.toFirExpression() }
|
||||
arguments += when (argument) {
|
||||
is KtLambdaArgument -> buildLambdaArgumentExpression {
|
||||
source = argument.toFirSourceElement()
|
||||
@@ -853,7 +858,8 @@ open class RawFirBuilder(
|
||||
}
|
||||
is KtDelegatedSuperTypeEntry -> {
|
||||
val type = superTypeListEntry.typeReference.toFirOrErrorType()
|
||||
val delegateExpression = { superTypeListEntry.delegateExpression }.toFirExpression("Should have delegate")
|
||||
val delegateExpression =
|
||||
disabledLazyMode { { superTypeListEntry.delegateExpression }.toFirExpression("Should have delegate") }
|
||||
container.superTypeRefs += type
|
||||
val delegateSource =
|
||||
superTypeListEntry.delegateExpression?.toFirSourceElement(KtFakeSourceElementKind.ClassDelegationField)
|
||||
@@ -964,7 +970,7 @@ open class RawFirBuilder(
|
||||
?: this@buildDelegatedConstructorCall.source?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall)
|
||||
superTypeRef = this@buildDelegatedConstructorCall.constructedTypeRef
|
||||
}
|
||||
superTypeCallEntry?.extractArgumentsTo(this)
|
||||
disabledLazyMode { superTypeCallEntry?.extractArgumentsTo(this) }
|
||||
}
|
||||
}
|
||||
if (this == null && owner !is KtEnumEntry) {
|
||||
@@ -1693,7 +1699,7 @@ open class RawFirBuilder(
|
||||
this.superTypeRef = this@buildDelegatedConstructorCall.constructedTypeRef
|
||||
}
|
||||
}
|
||||
extractArgumentsTo(this)
|
||||
disabledLazyMode { extractArgumentsTo(this) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FILE: annotation.kt
|
||||
@Target(AnnotationTarget#.CLASS#, AnnotationTarget#.PROPERTY#, AnnotationTarget#.LOCAL_VARIABLE#, AnnotationTarget#.VALUE_PARAMETER#, AnnotationTarget#.CONSTRUCTOR#, AnnotationTarget#.FUNCTION#, AnnotationTarget#.TYPE#) public? final? annotation class base : R|kotlin/Annotation| {
|
||||
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION) public? final? annotation class base : R|kotlin/Annotation| {
|
||||
public? constructor(): R|base| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ FILE: annotationsOnNullableParenthesizedTypes.kt
|
||||
public? get(): ( @A() C?.() -> C )
|
||||
|
||||
}
|
||||
@Target(AnnotationTarget#.TYPE#, AnnotationTarget#.TYPE_PARAMETER#) public? final? annotation class A : R|kotlin/Annotation| {
|
||||
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION) public? final? annotation class A : R|kotlin/Annotation| {
|
||||
public? constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ FILE: annotationsOnParenthesizedTypes.kt
|
||||
public? get(): ( (@A() C) -> C )
|
||||
|
||||
}
|
||||
@Target(AnnotationTarget#.TYPE#, AnnotationTarget#.TYPE_PARAMETER#) public? final? annotation class A : R|kotlin/Annotation| {
|
||||
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION) public? final? annotation class A : R|kotlin/Annotation| {
|
||||
public? constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
+3
-3
@@ -4,14 +4,14 @@ FILE: danglingAnnotationsClassLevel.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@Suppress(String()) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
@Suppress(LAZY_EXPRESSION) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
}
|
||||
public? final? class B : R|kotlin/Any| {
|
||||
public? constructor(): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@Suppress(String()) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
@Suppress(LAZY_EXPRESSION) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
}
|
||||
public? final? class Outer : R|kotlin/Any| {
|
||||
public? constructor(): R|Outer| {
|
||||
@@ -23,7 +23,7 @@ FILE: danglingAnnotationsClassLevel.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@Suppress(String()) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
@Suppress(LAZY_EXPRESSION) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
}
|
||||
|
||||
public? final? fun withLocal(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
FILE: danglingAnnotationsFileLevel.kt
|
||||
@Suppress(String()) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
@Suppress(LAZY_EXPRESSION) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
Vendored
+2
-2
@@ -1,11 +1,11 @@
|
||||
FILE: splitModifierList.kt
|
||||
@Target(AnnotationTarget#.TYPE#, AnnotationTarget#.TYPE_PARAMETER#) public? final? annotation class A : R|kotlin/Annotation| {
|
||||
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION) public? final? annotation class A : R|kotlin/Annotation| {
|
||||
public? constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
@Target(AnnotationTarget#.TYPE#, AnnotationTarget#.TYPE_PARAMETER#) public? final? annotation class B : R|kotlin/Annotation| {
|
||||
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION) public? final? annotation class B : R|kotlin/Annotation| {
|
||||
public? constructor(): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FILE: annotated.kt
|
||||
@Target(AnnotationTarget#.EXPRESSION#, AnnotationTarget#.LOCAL_VARIABLE#) @Retention(AnnotationRetention#.SOURCE#) public? final? annotation class Ann : R|kotlin/Annotation| {
|
||||
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION) @Retention(LAZY_EXPRESSION) public? final? annotation class Ann : R|kotlin/Annotation| {
|
||||
public? constructor(): R|Ann| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -26,25 +26,25 @@ FILE: collectionLiterals.kt
|
||||
public? get(): Array<String>
|
||||
|
||||
}
|
||||
@Ann1(<implicitArrayOf>()) @Ann2(<implicitArrayOf>()) @Ann3(<implicitArrayOf>()) public? final? class Zero : R|kotlin/Any| {
|
||||
@Ann1(LAZY_EXPRESSION) @Ann2(LAZY_EXPRESSION) @Ann3(LAZY_EXPRESSION) public? final? class Zero : R|kotlin/Any| {
|
||||
public? constructor(): R|Zero| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
@Ann1(<implicitArrayOf>(IntegerLiteral(1), IntegerLiteral(2))) public? final? class First : R|kotlin/Any| {
|
||||
@Ann1(LAZY_EXPRESSION) public? final? class First : R|kotlin/Any| {
|
||||
public? constructor(): R|First| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
@Ann2(<implicitArrayOf>(Double(3.14))) public? final? class Second : R|kotlin/Any| {
|
||||
@Ann2(LAZY_EXPRESSION) public? final? class Second : R|kotlin/Any| {
|
||||
public? constructor(): R|Second| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
@Ann3(<implicitArrayOf>(String(Alpha), String(Omega))) public? final? class Third : R|kotlin/Any| {
|
||||
@Ann3(LAZY_EXPRESSION) public? final? class Third : R|kotlin/Any| {
|
||||
public? constructor(): R|Third| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user