From c5cba4c053f9eb7f44fd17e896805cf537fb9fec Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Mon, 13 Nov 2023 14:40:17 +0100 Subject: [PATCH] [FIR] builder: provide containingDeclarationSymbol We cannot use only non-local declarations as anchors due to the same resolution logic between member declarations of local classes, so we have to support such cases as well ^KT-63042 --- .../LowLevelFirApiFacadeForResolveOnAir.kt | 5 +- .../lazy/resolve/FirLazyBodiesCalculator.kt | 2 +- .../resolve/RawFirFileAnnotationBuilder.kt | 28 +- .../RawFirNonLocalDeclarationBuilder.kt | 18 +- .../generators/CallAndReferenceGenerator.kt | 5 + .../LightTreeRawFirDeclarationBuilder.kt | 1359 +++++++++-------- .../lightTree/fir/DestructuringDeclaration.kt | 16 +- .../fir/lightTree/fir/ValueParameter.kt | 21 +- .../AbstractLightTree2FirConverterTestCase.kt | 7 +- .../kotlin/fir/builder/PsiConversionUtils.kt | 6 +- .../kotlin/fir/builder/PsiRawFirBuilder.kt | 1274 +++++++-------- .../annotation.annotationOwners.txt | 182 +++ .../annotationOnField.annotationOwners.txt | 39 + .../annotationOnProperty.annotationOwners.txt | 35 + ...annotationOnSuperType.annotationOwners.txt | 27 + ...tationOnSuperTypeCall.annotationOwners.txt | 39 + ...bleParenthesizedTypes.annotationOwners.txt | 51 + ...sOnParenthesizedTypes.annotationOwners.txt | 57 + ...sObjectWithAnnotation.annotationOwners.txt | 33 + ...WithLocalDeclarations.annotationOwners.txt | 11 + ...AnnotationsClassLevel.annotationOwners.txt | 39 + ...gAnnotationsFileLevel.annotationOwners.txt | 7 + ...aClassWithAnnotations.annotationOwners.txt | 107 ++ ...egatedFieldNestedName.annotationOwners.txt | 48 + ...egatesWithAnnotations.annotationOwners.txt | 67 + ...mEntryWithAnnotations.annotationOwners.txt | 31 + .../fileAnnotations.annotationOwners.txt | 15 + ...tationsWithoutPackage.annotationOwners.txt | 15 + ...WithLocalDeclarations.annotationOwners.txt | 11 + .../localAnnotations.annotationOwners.txt | 987 ++++++++++++ .../localImplicitType.annotationOwners.txt | 32 + .../multiDeclarations.annotationOwners.txt | 35 + ...cturingWithAnnotation.annotationOwners.txt | 23 + ...cturingWithAnnotation.annotationOwners.txt | 23 + ...tationAsLastStatement.annotationOwners.txt | 23 + .../secondaryConstructor.annotationOwners.txt | 15 + .../splitModifierList.annotationOwners.txt | 87 ++ .../annotated.annotationOwners.txt | 31 + .../collectionLiterals.annotationOwners.txt | 23 + ...AbstractRawFirBuilderLazyBodiesTestCase.kt | 4 +- .../builder/AbstractRawFirBuilderTestCase.kt | 97 +- .../fir/builder/AbstractRawFirBuilder.kt | 26 + .../jetbrains/kotlin/fir/builder/Context.kt | 70 + .../kotlin/fir/builder/Destructuring.kt | 27 +- .../compiler/fir/SerializationFirUtils.kt | 4 +- 45 files changed, 3767 insertions(+), 1295 deletions(-) create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnField.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnProperty.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnSuperType.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnSuperTypeCall.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnNullableParenthesizedTypes.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/anonymousObjectWithAnnotation.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorWithLocalDeclarations.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsClassLevel.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsFileLevel.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/dataClassWithAnnotations.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegatedFieldNestedName.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegatesWithAnnotations.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enumEntryWithAnnotations.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/fileAnnotations.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/fileAnnotationsWithoutPackage.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/initWithLocalDeclarations.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/localAnnotations.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/localImplicitType.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/multiDeclarations.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptLevelDestructuringWithAnnotation.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotation.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/secondaryConstructor.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/splitModifierList.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.annotationOwners.txt create mode 100644 compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/collectionLiterals.annotationOwners.txt diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/LowLevelFirApiFacadeForResolveOnAir.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/LowLevelFirApiFacadeForResolveOnAir.kt index dfeef02537a..bb135a907a1 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/LowLevelFirApiFacadeForResolveOnAir.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/LowLevelFirApiFacadeForResolveOnAir.kt @@ -249,10 +249,9 @@ object LowLevelFirApiFacadeForResolveOnAir { firResolveSession: LLFirResolvableResolveSession, ): FirAnnotation { val annotationCall = buildFileFirAnnotation( - session = firFile.moduleData.session, - baseScopeProvider = firFile.moduleData.session.kotlinScopeProvider, + firFile = firFile, fileAnnotation = annotationEntry, - replacement = replacement + replacement = replacement, ) val fileAnnotationsContainer = buildFileAnnotationsContainer { diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/FirLazyBodiesCalculator.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/FirLazyBodiesCalculator.kt index 18d321b0271..1cea6ca671e 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/FirLazyBodiesCalculator.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/FirLazyBodiesCalculator.kt @@ -81,7 +81,7 @@ internal object FirLazyBodiesCalculator { val builder = PsiRawFirBuilder(session, baseScopeProvider = session.kotlinScopeProvider) val ktAnnotationEntry = annotationCall.psi as KtAnnotationEntry builder.context.packageFqName = ktAnnotationEntry.containingKtFile.packageFqName - val newAnnotationCall = builder.buildAnnotationCall(ktAnnotationEntry) + val newAnnotationCall = builder.buildAnnotationCall(ktAnnotationEntry, annotationCall.containingDeclarationSymbol) return newAnnotationCall.argumentList } diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/RawFirFileAnnotationBuilder.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/RawFirFileAnnotationBuilder.kt index 569093ea6c0..d98bb30d1ab 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/RawFirFileAnnotationBuilder.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/RawFirFileAnnotationBuilder.kt @@ -1,35 +1,39 @@ /* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.builder.PsiRawFirBuilder +import org.jetbrains.kotlin.fir.declarations.FirFile import org.jetbrains.kotlin.fir.expressions.FirAnnotation -import org.jetbrains.kotlin.fir.scopes.FirScopeProvider +import org.jetbrains.kotlin.fir.scopes.kotlinScopeProvider import org.jetbrains.kotlin.psi.KtAnnotationEntry import org.jetbrains.kotlin.psi.KtElement internal fun buildFileFirAnnotation( - session: FirSession, - baseScopeProvider: FirScopeProvider, + firFile: FirFile, fileAnnotation: KtAnnotationEntry, - replacement: RawFirReplacement? = null + replacement: RawFirReplacement, ): FirAnnotation { - - val replacementApplier = replacement?.Applier() - + val session = firFile.moduleData.session + val baseScopeProvider = firFile.moduleData.session.kotlinScopeProvider + val replacementApplier = replacement.Applier() val builder = object : PsiRawFirBuilder(session, baseScopeProvider) { inner class VisitorWithReplacement : Visitor() { override fun convertElement(element: KtElement, original: FirElement?): FirElement? = - super.convertElement(replacementApplier?.tryReplace(element) ?: element, original) + super.convertElement(replacementApplier.tryReplace(element), original) } } + builder.context.packageFqName = fileAnnotation.containingKtFile.packageFqName - val result = builder.VisitorWithReplacement().convertElement(fileAnnotation, null) as FirAnnotation - replacementApplier?.ensureApplied() + val visitor = builder.VisitorWithReplacement() + val result = builder.withContainerSymbol(firFile.symbol) { + visitor.convertElement(fileAnnotation, null) as FirAnnotation + } + + replacementApplier.ensureApplied() return result } diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/RawFirNonLocalDeclarationBuilder.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/RawFirNonLocalDeclarationBuilder.kt index 04b52b0454c..e4f262023fb 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/RawFirNonLocalDeclarationBuilder.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/RawFirNonLocalDeclarationBuilder.kt @@ -31,6 +31,7 @@ import org.jetbrains.kotlin.name.NameUtils import org.jetbrains.kotlin.psi import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.hasExpectModifier +import org.jetbrains.kotlin.util.PrivateForInline import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment internal class RawFirNonLocalDeclarationBuilder private constructor( @@ -76,16 +77,17 @@ internal class RawFirNonLocalDeclarationBuilder private constructor( else -> null } - return build(session, scopeProvider, designation, rootNonLocalDeclaration, functionsToRebind) + return build(session, scopeProvider, designation, rootNonLocalDeclaration, functionsToRebind, rebindContainingSymbol = true) } - fun build( + private fun build( session: FirSession, scopeProvider: FirScopeProvider, designation: FirDesignation, rootNonLocalDeclaration: KtElement, functionsToRebind: Set? = null, - replacementApplier: RawFirReplacement.Applier? = null + replacementApplier: RawFirReplacement.Applier? = null, + rebindContainingSymbol: Boolean = false, ): FirDeclaration { check(rootNonLocalDeclaration is KtDeclaration || rootNonLocalDeclaration is KtCodeFragment) @@ -98,6 +100,11 @@ internal class RawFirNonLocalDeclarationBuilder private constructor( replacementApplier = replacementApplier ) builder.context.packageFqName = rootNonLocalDeclaration.containingKtFile.packageFqName + if (rebindContainingSymbol) { + @OptIn(PrivateForInline::class) + builder.context.forcedContainerSymbol = designation.target.symbol + } + return builder.moveNext(designation.path.iterator(), containingClass = null) } } @@ -299,10 +306,9 @@ internal class RawFirNonLocalDeclarationBuilder private constructor( if (superTypeListEntry is KtDelegatedSuperTypeEntry) { val expectedName = NameUtils.delegateFieldName(index) if (originalDeclaration.name == expectedName) { - return buildFieldForSupertypeDelegate( - superTypeListEntry, superTypeListEntry.typeReference.toFirOrErrorType(), index - ) + return buildFieldForSupertypeDelegate(superTypeListEntry, type = null, index) } + index++ } } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index fb670f7ccb7..7bd9ecd8e31 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -824,6 +824,11 @@ class CallAndReferenceGenerator( name = symbol.classId.shortClassName resolvedSymbol = constructorSymbol } + + /** + * This is not right, but it doesn't make sense as [FirAnnotationCall.containingDeclarationSymbol] uses only in FIR + */ + containingDeclarationSymbol = constructorSymbol } } diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt index a4bb9d38cc8..9969f18e774 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -82,7 +82,6 @@ class LightTreeRawFirDeclarationBuilder( context.packageFqName = FqName.ROOT var packageDirective: FirPackageDirective? = null file.forEachChildren { child -> - @Suppress("RemoveRedundantQualifierName") when (child.tokenType) { FILE_ANNOTATION_LIST -> fileAnnotationContainer = convertFileAnnotationsContainer(child, fileSymbol) PACKAGE_DIRECTIVE -> { @@ -243,15 +242,18 @@ class LightTreeRawFirDeclarationBuilder( /***** MODIFIERS *****/ /** + * @param skipAnnotations skip annotations as they are requiring correct [withContainerSymbol] * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseModifierList */ - private fun convertModifierList(modifiers: LighterASTNode, isInClass: Boolean = false): Modifier { + private fun convertModifierList(modifiers: LighterASTNode, isInClass: Boolean = false, skipAnnotations: Boolean = false): Modifier { val modifier = Modifier() modifiers.forEachChildren { - when (it.tokenType) { - ANNOTATION -> modifier.annotations += convertAnnotation(it) - ANNOTATION_ENTRY -> modifier.annotations += convertAnnotationEntry(it) - is KtModifierKeywordToken -> modifier.addModifier(it, isInClass) + val tokenType = it.tokenType + when { + tokenType is KtModifierKeywordToken -> modifier.addModifier(it, isInClass) + skipAnnotations -> {} + tokenType == ANNOTATION -> modifier.annotations += convertAnnotation(it) + tokenType == ANNOTATION_ENTRY -> modifier.annotations += convertAnnotationEntry(it) } } return modifier @@ -314,10 +316,12 @@ class LightTreeRawFirDeclarationBuilder( moduleData = baseModuleData source = fileAnnotationList.toFirSourceElement() containingFileSymbol = fileSymbol - annotations += fileAnnotationList.forEachChildrenReturnList { node, container -> - when (node.tokenType) { - ANNOTATION -> container += convertAnnotation(node) - ANNOTATION_ENTRY -> container += convertAnnotationEntry(node) + withContainerSymbol(fileSymbol) { + annotations += fileAnnotationList.forEachChildrenReturnList { node, container -> + when (node.tokenType) { + ANNOTATION -> container += convertAnnotation(node) + ANNOTATION_ENTRY -> container += convertAnnotationEntry(node) + } } } @@ -398,6 +402,7 @@ class LightTreeRawFirDeclarationBuilder( calleeReference = theCalleeReference extractArgumentsFrom(constructorCalleePair.second) typeArguments += qualifier?.typeArgumentList?.typeArguments ?: listOf() + containingDeclarationSymbol = context.containerSymbol } } else { buildErrorAnnotationCall { @@ -408,6 +413,7 @@ class LightTreeRawFirDeclarationBuilder( calleeReference = theCalleeReference extractArgumentsFrom(constructorCalleePair.second) typeArguments += qualifier?.typeArgumentList?.typeArguments ?: listOf() + containingDeclarationSymbol = context.containerSymbol } } } @@ -432,27 +438,10 @@ class LightTreeRawFirDeclarationBuilder( var classBody: LighterASTNode? = null var superTypeList: LighterASTNode? = null var typeParameterList: LighterASTNode? = null - classNode.forEachChildren { when (it.tokenType) { - MODIFIER_LIST -> modifiers = convertModifierList(it, isInClass = true) - CLASS_KEYWORD -> classKind = ClassKind.CLASS - INTERFACE_KEYWORD -> classKind = ClassKind.INTERFACE - OBJECT_KEYWORD -> classKind = ClassKind.OBJECT + MODIFIER_LIST -> modifiers = convertModifierList(it, isInClass = true, skipAnnotations = true) IDENTIFIER -> identifier = it.asText - TYPE_PARAMETER_LIST -> typeParameterList = it - PRIMARY_CONSTRUCTOR -> primaryConstructor = it - SUPER_TYPE_LIST -> superTypeList = it - TYPE_CONSTRAINT_LIST -> typeConstraints += convertTypeConstraints(it) - CLASS_BODY -> classBody = it - } - } - - if (classKind == ClassKind.CLASS) { - classKind = when { - modifiers.isEnum() -> ClassKind.ENUM_CLASS - modifiers.isAnnotation() -> ClassKind.ANNOTATION_CLASS - else -> classKind } } @@ -464,176 +453,201 @@ class LightTreeRawFirDeclarationBuilder( ?.getReferencedNameAsName() == StandardNames.BUILT_INS_PACKAGE_NAME return withChildClassName(className, isExpect = classIsExpect, isLocalWithinParent) { - val isLocal = context.inLocalContext - val status = FirDeclarationStatusImpl( - if (isLocal) Visibilities.Local else modifiers.getVisibility(), - modifiers.getModality(isClassOrObject = true) - ).apply { - isExpect = classIsExpect - isActual = modifiers.hasActual() - isInner = modifiers.isInner() - isCompanion = modifiers.isCompanion() && classKind == ClassKind.OBJECT - isData = modifiers.isDataClass() - isInline = modifiers.isInlineClass() - isFun = modifiers.isFunctionalInterface() - isExternal = modifiers.hasExternal() - } - val classSymbol = FirRegularClassSymbol(context.currentClassId) + withContainerSymbol(classSymbol) { + classNode.forEachChildren { + when (it.tokenType) { + MODIFIER_LIST -> modifiers = convertModifierList(it, isInClass = true) + CLASS_KEYWORD -> classKind = ClassKind.CLASS + INTERFACE_KEYWORD -> classKind = ClassKind.INTERFACE + OBJECT_KEYWORD -> classKind = ClassKind.OBJECT + TYPE_PARAMETER_LIST -> typeParameterList = it + PRIMARY_CONSTRUCTOR -> primaryConstructor = it + SUPER_TYPE_LIST -> superTypeList = it + TYPE_CONSTRAINT_LIST -> typeConstraints += convertTypeConstraints(it) + CLASS_BODY -> classBody = it + } + } - typeParameterList?.let { firTypeParameters += convertTypeParameters(it, typeConstraints, classSymbol) } + if (classKind == ClassKind.CLASS) { + classKind = when { + modifiers.isEnum() -> ClassKind.ENUM_CLASS + modifiers.isAnnotation() -> ClassKind.ANNOTATION_CLASS + else -> classKind + } + } - withCapturedTypeParameters(status.isInner || isLocal, classNode.toFirSourceElement(), firTypeParameters) { - var delegatedFieldsMap: Map? = null - buildRegularClass { - source = classNode.toFirSourceElement() - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - name = className - this.status = status - this.classKind = classKind - scopeProvider = baseScopeProvider - symbol = classSymbol - annotations += modifiers.annotations - typeParameters += firTypeParameters + val isLocal = context.inLocalContext + val status = FirDeclarationStatusImpl( + if (isLocal) Visibilities.Local else modifiers.getVisibility(), + modifiers.getModality(isClassOrObject = true) + ).apply { + isExpect = classIsExpect + isActual = modifiers.hasActual() + isInner = modifiers.isInner() + isCompanion = modifiers.isCompanion() && classKind == ClassKind.OBJECT + isData = modifiers.isDataClass() + isInline = modifiers.isInlineClass() + isFun = modifiers.isFunctionalInterface() + isExternal = modifiers.hasExternal() + } - context.appendOuterTypeParameters(ignoreLastLevel = true, typeParameters) - val selfType = classNode.toDelegatedSelfType(this) - registerSelfType(selfType) + typeParameterList?.let { firTypeParameters += convertTypeParameters(it, typeConstraints, classSymbol) } - val delegationSpecifiers = superTypeList?.let { convertDelegationSpecifiers(it) } - var delegatedSuperTypeRef: FirTypeRef? = delegationSpecifiers?.superTypeCalls?.lastOrNull()?.delegatedSuperTypeRef - val delegatedConstructorSource: KtLightSourceElement? = delegationSpecifiers?.superTypeCalls?.lastOrNull()?.source + withCapturedTypeParameters(status.isInner || isLocal, classNode.toFirSourceElement(), firTypeParameters) { + var delegatedFieldsMap: Map? = null + buildRegularClass { + source = classNode.toFirSourceElement() + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + name = className + this.status = status + this.classKind = classKind + scopeProvider = baseScopeProvider + symbol = classSymbol + annotations += modifiers.annotations + typeParameters += firTypeParameters - val superTypeRefs = mutableListOf() + context.appendOuterTypeParameters(ignoreLastLevel = true, typeParameters) - delegationSpecifiers?.let { superTypeRefs += it.superTypesRef } + val selfType = classNode.toDelegatedSelfType(this) + registerSelfType(selfType) - when { - modifiers.isEnum() && (classKind == ClassKind.ENUM_CLASS) && delegatedConstructorSource == null -> { - delegatedSuperTypeRef = buildResolvedTypeRef { - type = ConeClassLikeTypeImpl( - implicitEnumType.type.lookupTag, - arrayOf(selfType.type), - isNullable = false - ) + val delegationSpecifiers = superTypeList?.let { convertDelegationSpecifiers(it) } + var delegatedSuperTypeRef: FirTypeRef? = delegationSpecifiers?.superTypeCalls?.lastOrNull()?.delegatedSuperTypeRef + val delegatedConstructorSource: KtLightSourceElement? = delegationSpecifiers?.superTypeCalls?.lastOrNull()?.source + + val superTypeRefs = mutableListOf() + + delegationSpecifiers?.let { superTypeRefs += it.superTypesRef } + + when { + modifiers.isEnum() && (classKind == ClassKind.ENUM_CLASS) && delegatedConstructorSource == null -> { + delegatedSuperTypeRef = buildResolvedTypeRef { + type = ConeClassLikeTypeImpl( + implicitEnumType.type.lookupTag, + arrayOf(selfType.type), + isNullable = false + ) + } + superTypeRefs += delegatedSuperTypeRef + } + modifiers.isAnnotation() && (classKind == ClassKind.ANNOTATION_CLASS) -> { + superTypeRefs += implicitAnnotationType + delegatedSuperTypeRef = implicitAnyType } - superTypeRefs += delegatedSuperTypeRef } - modifiers.isAnnotation() && (classKind == ClassKind.ANNOTATION_CLASS) -> { - superTypeRefs += implicitAnnotationType + + if (superTypeRefs.isEmpty() && !classIsKotlinAny) { + superTypeRefs += implicitAnyType delegatedSuperTypeRef = implicitAnyType } - } - if (superTypeRefs.isEmpty() && !classIsKotlinAny) { - superTypeRefs += implicitAnyType - delegatedSuperTypeRef = implicitAnyType - } + this.superTypeRefs += superTypeRefs - this.superTypeRefs += superTypeRefs - - val secondaryConstructors = classBody.getChildNodesByType(SECONDARY_CONSTRUCTOR) - val classWrapper = ClassWrapper( - modifiers, classKind, this, hasSecondaryConstructor = secondaryConstructors.isNotEmpty(), - hasDefaultConstructor = if (primaryConstructor != null) !primaryConstructor!!.hasValueParameters() - else secondaryConstructors.isEmpty() || secondaryConstructors.any { !it.hasValueParameters() }, - delegatedSelfTypeRef = selfType, - delegatedSuperTypeRef = delegatedSuperTypeRef ?: FirImplicitTypeRefImplWithoutSource, - delegatedSuperCalls = delegationSpecifiers?.superTypeCalls ?: emptyList() - ) - //parse primary constructor - val primaryConstructorWrapper = convertPrimaryConstructor( - classNode, - primaryConstructor, - selfType.source, - classWrapper, - delegatedConstructorSource, - containingClassIsExpectClass = status.isExpect, - isImplicitlyActual = status.isActual && (status.isInline || classKind == ClassKind.ANNOTATION_CLASS), - isKotlinAny = classIsKotlinAny, - ) - val firPrimaryConstructor = primaryConstructorWrapper?.firConstructor - firPrimaryConstructor?.let { declarations += it } - delegationSpecifiers?.delegateFieldsMap?.values?.mapTo(declarations) { it.fir } - delegatedFieldsMap = delegationSpecifiers?.delegateFieldsMap?.takeIf { it.isNotEmpty() } - - val properties = mutableListOf() - if (primaryConstructor != null && firPrimaryConstructor != null) { - //parse properties - properties += primaryConstructorWrapper.valueParameters - .filter { it.hasValOrVar() } - .map { - it.toFirPropertyFromPrimaryConstructor( - baseModuleData, - callableIdForName(it.firValueParameter.name), - classIsExpect, - currentDispatchReceiverType(), - context - ) - } - addDeclarations(properties) - } - - //parse declarations - classBody?.let { - addDeclarations(convertClassBody(it, classWrapper)) - } - - //parse data class - if (modifiers.isDataClass() && firPrimaryConstructor != null) { - val zippedParameters = properties.map { it.source!!.lighterASTNode to it } - DataClassMembersGenerator( + val secondaryConstructors = classBody.getChildNodesByType(SECONDARY_CONSTRUCTOR) + val classWrapper = ClassWrapper( + modifiers, classKind, this, hasSecondaryConstructor = secondaryConstructors.isNotEmpty(), + hasDefaultConstructor = if (primaryConstructor != null) !primaryConstructor!!.hasValueParameters() + else secondaryConstructors.isEmpty() || secondaryConstructors.any { !it.hasValueParameters() }, + delegatedSelfTypeRef = selfType, + delegatedSuperTypeRef = delegatedSuperTypeRef ?: FirImplicitTypeRefImplWithoutSource, + delegatedSuperCalls = delegationSpecifiers?.superTypeCalls ?: emptyList() + ) + //parse primary constructor + val primaryConstructorWrapper = convertPrimaryConstructor( classNode, - this, - zippedParameters, - context.packageFqName, - context.className, - createClassTypeRefWithSourceKind = { firPrimaryConstructor.returnTypeRef.copyWithNewSourceKind(it) }, - createParameterTypeRefWithSourceKind = { property, kind -> property.returnTypeRef.copyWithNewSourceKind(kind) }, - addValueParameterAnnotations = { valueParam -> - valueParam.forEachChildren { - if (it.tokenType == MODIFIER_LIST) convertModifierList(it).annotations.filterTo(annotations) { - it.useSiteTarget.appliesToPrimaryConstructorParameter() - } + primaryConstructor, + selfType.source, + classWrapper, + delegatedConstructorSource, + containingClassIsExpectClass = status.isExpect, + isImplicitlyActual = status.isActual && (status.isInline || classKind == ClassKind.ANNOTATION_CLASS), + isKotlinAny = classIsKotlinAny, + ) + val firPrimaryConstructor = primaryConstructorWrapper?.firConstructor + firPrimaryConstructor?.let { declarations += it } + delegationSpecifiers?.delegateFieldsMap?.values?.mapTo(declarations) { it.fir } + delegatedFieldsMap = delegationSpecifiers?.delegateFieldsMap?.takeIf { it.isNotEmpty() } + + val properties = mutableListOf() + if (primaryConstructor != null && firPrimaryConstructor != null) { + //parse properties + properties += primaryConstructorWrapper.valueParameters + .filter { it.hasValOrVar() } + .map { + it.toFirPropertyFromPrimaryConstructor( + baseModuleData, + callableIdForName(it.firValueParameter.name), + classIsExpect, + currentDispatchReceiverType(), + context + ) } - }, - ).generate() - } + addDeclarations(properties) + } - if (modifiers.isEnum()) { - generateValuesFunction( - baseModuleData, - context.packageFqName, - context.className, - classIsExpect - ) - generateValueOfFunction( - baseModuleData, - context.packageFqName, - context.className, - classIsExpect - ) - generateEntriesGetter( - baseModuleData, - context.packageFqName, - context.className, - classIsExpect - ) - } - initCompanionObjectSymbolAttr() + //parse declarations + classBody?.let { + addDeclarations(convertClassBody(it, classWrapper)) + } - contextReceivers.addAll(convertContextReceivers(classNode)) + //parse data class + if (modifiers.isDataClass() && firPrimaryConstructor != null) { + val zippedParameters = properties.map { it.source!!.lighterASTNode to it } + DataClassMembersGenerator( + classNode, + this, + zippedParameters, + context.packageFqName, + context.className, + createClassTypeRefWithSourceKind = { firPrimaryConstructor.returnTypeRef.copyWithNewSourceKind(it) }, + createParameterTypeRefWithSourceKind = { property, kind -> property.returnTypeRef.copyWithNewSourceKind(kind) }, + addValueParameterAnnotations = { valueParam -> + valueParam.forEachChildren { + if (it.tokenType == MODIFIER_LIST) convertModifierList(it).annotations.filterTo(annotations) { + it.useSiteTarget.appliesToPrimaryConstructorParameter() + } + } + }, + ).generate() + } + + if (modifiers.isEnum()) { + generateValuesFunction( + baseModuleData, + context.packageFqName, + context.className, + classIsExpect + ) + generateValueOfFunction( + baseModuleData, + context.packageFqName, + context.className, + classIsExpect + ) + generateEntriesGetter( + baseModuleData, + context.packageFqName, + context.className, + classIsExpect + ) + } + initCompanionObjectSymbolAttr() + + contextReceivers.addAll(convertContextReceivers(classNode)) + }.also { + it.delegateFieldsMap = delegatedFieldsMap + } }.also { - it.delegateFieldsMap = delegatedFieldsMap + fillDanglingConstraintsTo(firTypeParameters, typeConstraints, it) } } }.also { if (classNode.getParent()?.elementType == KtStubElementTypes.CLASS_BODY) { it.initContainingClassForLocalAttr() } - fillDanglingConstraintsTo(firTypeParameters, typeConstraints, it) } } @@ -734,85 +748,92 @@ class LightTreeRawFirDeclarationBuilder( val enumSuperTypeCallEntry = mutableListOf() var classBodyNode: LighterASTNode? = null var superTypeCallEntry: LighterASTNode? = null - enumEntry.forEachChildren { - when (it.tokenType) { - MODIFIER_LIST -> modifiers = convertModifierList(it) - IDENTIFIER -> identifier = it.asText - INITIALIZER_LIST -> { - enumSuperTypeCallEntry += convertInitializerList(it) - it.getChildNodeByType(SUPER_TYPE_CALL_ENTRY)?.let { superTypeCall -> - superTypeCallEntry = superTypeCall - } - } - CLASS_BODY -> classBodyNode = it - } + enumEntry.getChildNodeByType(IDENTIFIER)?.let { + identifier = it.asText } val enumEntryName = identifier.nameAsSafeName() val containingClassIsExpectClass = classWrapper.hasExpect() || context.containerIsExpect return buildEnumEntry { - source = enumEntry.toFirSourceElement() - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - returnTypeRef = classWrapper.delegatedSelfTypeRef - name = enumEntryName symbol = FirEnumEntrySymbol(CallableId(context.currentClassId, enumEntryName)) - status = FirDeclarationStatusImpl(Visibilities.Public, Modality.FINAL).apply { - isStatic = true - isExpect = containingClassIsExpectClass - } - if (classWrapper.hasDefaultConstructor && enumEntry.getChildNodeByType(INITIALIZER_LIST) == null && - modifiers.annotations.isEmpty() && classBodyNode == null - ) { - return@buildEnumEntry - } - annotations += modifiers.annotations - initializer = withChildClassName(enumEntryName, isExpect = false) { - buildAnonymousObjectExpression { - val entrySource = enumEntry.toFirSourceElement(KtFakeSourceElementKind.EnumInitializer) - source = entrySource - anonymousObject = buildAnonymousObject { + withContainerSymbol(symbol) { + enumEntry.forEachChildren { + when (it.tokenType) { + MODIFIER_LIST -> modifiers = convertModifierList(it) + INITIALIZER_LIST -> { + enumSuperTypeCallEntry += convertInitializerList(it) + it.getChildNodeByType(SUPER_TYPE_CALL_ENTRY)?.let { superTypeCall -> + superTypeCallEntry = superTypeCall + } + } + CLASS_BODY -> classBodyNode = it + } + } + + source = enumEntry.toFirSourceElement() + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + returnTypeRef = classWrapper.delegatedSelfTypeRef + name = enumEntryName + status = FirDeclarationStatusImpl(Visibilities.Public, Modality.FINAL).apply { + isStatic = true + isExpect = containingClassIsExpectClass + } + if (classWrapper.hasDefaultConstructor && enumEntry.getChildNodeByType(INITIALIZER_LIST) == null && + modifiers.annotations.isEmpty() && classBodyNode == null + ) { + return@buildEnumEntry + } + annotations += modifiers.annotations + initializer = withChildClassName(enumEntryName, isExpect = false) { + buildAnonymousObjectExpression { + val entrySource = enumEntry.toFirSourceElement(KtFakeSourceElementKind.EnumInitializer) source = entrySource - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - classKind = ClassKind.ENUM_ENTRY - scopeProvider = baseScopeProvider - symbol = FirAnonymousObjectSymbol(context.packageFqName) - status = FirDeclarationStatusImpl(Visibilities.Local, Modality.FINAL) - val enumClassWrapper = ClassWrapper( - modifiers, - ClassKind.ENUM_ENTRY, - this, - hasSecondaryConstructor = classBodyNode.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(), - hasDefaultConstructor = false, - delegatedSelfTypeRef = buildResolvedTypeRef { - type = ConeClassLikeTypeImpl( - this@buildAnonymousObject.symbol.toLookupTag(), - ConeTypeProjection.EMPTY_ARRAY, - isNullable = false + anonymousObject = buildAnonymousObject { + source = entrySource + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + classKind = ClassKind.ENUM_ENTRY + scopeProvider = baseScopeProvider + symbol = FirAnonymousObjectSymbol(context.packageFqName) + status = FirDeclarationStatusImpl(Visibilities.Local, Modality.FINAL) + val enumClassWrapper = ClassWrapper( + modifiers, + ClassKind.ENUM_ENTRY, + this, + hasSecondaryConstructor = classBodyNode.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(), + hasDefaultConstructor = false, + delegatedSelfTypeRef = buildResolvedTypeRef { + type = ConeClassLikeTypeImpl( + this@buildAnonymousObject.symbol.toLookupTag(), + ConeTypeProjection.EMPTY_ARRAY, + isNullable = false + ) + }.also { registerSelfType(it) }, + delegatedSuperTypeRef = classWrapper.delegatedSelfTypeRef, + delegatedSuperCalls = listOf( + DelegatedConstructorWrapper( + classWrapper.delegatedSelfTypeRef, + enumSuperTypeCallEntry, + superTypeCallEntry?.toFirSourceElement(), + ) ) - }.also { registerSelfType(it) }, - delegatedSuperTypeRef = classWrapper.delegatedSelfTypeRef, - delegatedSuperCalls = listOf(DelegatedConstructorWrapper( - classWrapper.delegatedSelfTypeRef, - enumSuperTypeCallEntry, + ) + superTypeRefs += enumClassWrapper.delegatedSuperTypeRef + convertPrimaryConstructor( + enumEntry, + null, + enumEntry.toFirSourceElement(), + enumClassWrapper, superTypeCallEntry?.toFirSourceElement(), - )) - ) - superTypeRefs += enumClassWrapper.delegatedSuperTypeRef - convertPrimaryConstructor( - enumEntry, - null, - enumEntry.toFirSourceElement(), - enumClassWrapper, - superTypeCallEntry?.toFirSourceElement(), - isEnumEntry = true, - containingClassIsExpectClass = containingClassIsExpectClass - )?.let { declarations += it.firConstructor } - classBodyNode?.also { - // Use ANONYMOUS_OBJECT_NAME for the owner class id of enum entry declarations - withChildClassName(SpecialNames.ANONYMOUS, forceLocalContext = true, isExpect = false) { - declarations += convertClassBody(it, enumClassWrapper) + isEnumEntry = true, + containingClassIsExpectClass = containingClassIsExpectClass + )?.let { declarations += it.firConstructor } + classBodyNode?.also { + // Use ANONYMOUS_OBJECT_NAME for the owner class id of enum entry declarations + withChildClassName(SpecialNames.ANONYMOUS, forceLocalContext = true, isExpect = false) { + declarations += convertClassBody(it, enumClassWrapper) + } } } } @@ -872,7 +893,9 @@ class LightTreeRawFirDeclarationBuilder( origin = FirDeclarationOrigin.Source diagnostic = ConeDanglingModifierOnTopLevel symbol = FirDanglingModifierSymbol() - annotations += convertModifierList(node).annotations + withContainerSymbol(symbol) { + annotations += convertModifierList(node).annotations + } } /** @@ -900,103 +923,110 @@ class LightTreeRawFirDeclarationBuilder( } val constructorSymbol = FirConstructorSymbol(callableIdForClassConstructor()) - var modifiersIfPresent: Modifier? = null - val valueParameters = mutableListOf() - var hasConstructorKeyword = false - primaryConstructor?.forEachChildren { - when (it.tokenType) { - MODIFIER_LIST -> modifiersIfPresent = convertModifierList(it) - CONSTRUCTOR_KEYWORD -> hasConstructorKeyword = true - VALUE_PARAMETER_LIST -> valueParameters += convertValueParameters(it, constructorSymbol, ValueParameterDeclaration.PRIMARY_CONSTRUCTOR) + withContainerSymbol(constructorSymbol) { + var modifiersIfPresent: Modifier? = null + val valueParameters = mutableListOf() + var hasConstructorKeyword = false + primaryConstructor?.forEachChildren { + when (it.tokenType) { + MODIFIER_LIST -> modifiersIfPresent = convertModifierList(it) + CONSTRUCTOR_KEYWORD -> hasConstructorKeyword = true + VALUE_PARAMETER_LIST -> valueParameters += convertValueParameters( + it, + constructorSymbol, + ValueParameterDeclaration.PRIMARY_CONSTRUCTOR + ) + } } - } - val modifiers = modifiersIfPresent ?: Modifier() - val defaultVisibility = classWrapper.defaultConstructorVisibility() - val firDelegatedCall = runUnless(containingClassIsExpectClass || isKotlinAny) { - fun createDelegatedConstructorCall( - delegatedConstructorSource: KtLightSourceElement?, - delegatedSuperTypeRef: FirTypeRef, - arguments: List, - ): FirDelegatedConstructorCall { - return buildDelegatedConstructorCall { - source = delegatedConstructorSource - ?: primaryConstructor?.toFirSourceElement(KtFakeSourceElementKind.DelegatingConstructorCall) - ?: selfTypeSource?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall) - constructedTypeRef = delegatedSuperTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.ImplicitTypeRef) - isThis = false - calleeReference = buildExplicitSuperReference { - //[dirty] in case of enum classWrapper.delegatedSuperTypeRef.source is whole enum source - source = if (!isEnumEntry) { - classWrapper.delegatedSuperTypeRef.source?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall) - ?: this@buildDelegatedConstructorCall.source?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall) - } else { - delegatedConstructorSource - ?.lighterASTNode - ?.getChildNodeByType(CONSTRUCTOR_CALLEE) - ?.toFirSourceElement(KtFakeSourceElementKind.DelegatingConstructorCall) - ?: this@buildDelegatedConstructorCall.source + val modifiers = modifiersIfPresent ?: Modifier() + + val defaultVisibility = classWrapper.defaultConstructorVisibility() + val firDelegatedCall = runUnless(containingClassIsExpectClass || isKotlinAny) { + fun createDelegatedConstructorCall( + delegatedConstructorSource: KtLightSourceElement?, + delegatedSuperTypeRef: FirTypeRef, + arguments: List, + ): FirDelegatedConstructorCall { + return buildDelegatedConstructorCall { + source = delegatedConstructorSource + ?: primaryConstructor?.toFirSourceElement(KtFakeSourceElementKind.DelegatingConstructorCall) + ?: selfTypeSource?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall) + constructedTypeRef = delegatedSuperTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.ImplicitTypeRef) + isThis = false + calleeReference = buildExplicitSuperReference { + //[dirty] in case of enum classWrapper.delegatedSuperTypeRef.source is whole enum source + source = if (!isEnumEntry) { + classWrapper.delegatedSuperTypeRef.source?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall) + ?: this@buildDelegatedConstructorCall.source?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall) + } else { + delegatedConstructorSource + ?.lighterASTNode + ?.getChildNodeByType(CONSTRUCTOR_CALLEE) + ?.toFirSourceElement(KtFakeSourceElementKind.DelegatingConstructorCall) + ?: this@buildDelegatedConstructorCall.source + } + + superTypeRef = this@buildDelegatedConstructorCall.constructedTypeRef } - - superTypeRef = this@buildDelegatedConstructorCall.constructedTypeRef + extractArgumentsFrom(arguments) } - extractArgumentsFrom(arguments) } - } - if (classWrapper.delegatedSuperCalls.size <= 1) { - createDelegatedConstructorCall( - delegatedConstructorSource, - classWrapper.delegatedSuperTypeRef, - classWrapper.delegatedSuperCalls.lastOrNull()?.arguments ?: emptyList(), - ) - } else { - buildMultiDelegatedConstructorCall { - classWrapper.delegatedSuperCalls.mapTo(delegatedConstructorCalls) { (delegatedSuperTypeRef, arguments, source) -> - createDelegatedConstructorCall(source, delegatedSuperTypeRef, arguments) + if (classWrapper.delegatedSuperCalls.size <= 1) { + createDelegatedConstructorCall( + delegatedConstructorSource, + classWrapper.delegatedSuperTypeRef, + classWrapper.delegatedSuperCalls.lastOrNull()?.arguments ?: emptyList(), + ) + } else { + buildMultiDelegatedConstructorCall { + classWrapper.delegatedSuperCalls.mapTo(delegatedConstructorCalls) { (delegatedSuperTypeRef, arguments, source) -> + createDelegatedConstructorCall(source, delegatedSuperTypeRef, arguments) + } } } } - } - val explicitVisibility = runIf(primaryConstructor != null) { - modifiers.getVisibility().takeUnless { it == Visibilities.Unknown } - } - val status = FirDeclarationStatusImpl(explicitVisibility ?: defaultVisibility, Modality.FINAL).apply { - isExpect = modifiers.hasExpect() || context.containerIsExpect - isActual = modifiers.hasActual() || isImplicitlyActual - isInner = classWrapper.isInner() - isFromSealedClass = classWrapper.isSealed() && explicitVisibility !== Visibilities.Private - isFromEnumClass = classWrapper.isEnum() - } + val explicitVisibility = runIf(primaryConstructor != null) { + modifiers.getVisibility().takeUnless { it == Visibilities.Unknown } + } + val status = FirDeclarationStatusImpl(explicitVisibility ?: defaultVisibility, Modality.FINAL).apply { + isExpect = modifiers.hasExpect() || context.containerIsExpect + isActual = modifiers.hasActual() || isImplicitlyActual + isInner = classWrapper.isInner() + isFromSealedClass = classWrapper.isSealed() && explicitVisibility !== Visibilities.Private + isFromEnumClass = classWrapper.isEnum() + } - val builder = when { - modifiersIfPresent != null && !hasConstructorKeyword -> createErrorConstructorBuilder(ConeMissingConstructorKeyword) - isErrorConstructor -> createErrorConstructorBuilder(ConeNoConstructorError) - else -> FirPrimaryConstructorBuilder() - } - builder.apply { - source = primaryConstructor?.toFirSourceElement() - ?: selfTypeSource?.fakeElement(KtFakeSourceElementKind.ImplicitConstructor) - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - returnTypeRef = classWrapper.delegatedSelfTypeRef - dispatchReceiverType = classWrapper.obtainDispatchReceiverForConstructor() - this.status = status - symbol = constructorSymbol - annotations += modifiers.annotations - typeParameters += constructorTypeParametersFromConstructedClass(classWrapper.classBuilder.typeParameters) - this.valueParameters += valueParameters.map { it.firValueParameter } - delegatedConstructor = firDelegatedCall - this.body = null - this.contextReceivers.addAll(convertContextReceivers(classNode)) - } + val builder = when { + modifiersIfPresent != null && !hasConstructorKeyword -> createErrorConstructorBuilder(ConeMissingConstructorKeyword) + isErrorConstructor -> createErrorConstructorBuilder(ConeNoConstructorError) + else -> FirPrimaryConstructorBuilder() + } + builder.apply { + source = primaryConstructor?.toFirSourceElement() + ?: selfTypeSource?.fakeElement(KtFakeSourceElementKind.ImplicitConstructor) + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + returnTypeRef = classWrapper.delegatedSelfTypeRef + dispatchReceiverType = classWrapper.obtainDispatchReceiverForConstructor() + this.status = status + symbol = constructorSymbol + annotations += modifiers.annotations + typeParameters += constructorTypeParametersFromConstructedClass(classWrapper.classBuilder.typeParameters) + this.valueParameters += valueParameters.map { it.firValueParameter } + delegatedConstructor = firDelegatedCall + this.body = null + this.contextReceivers.addAll(convertContextReceivers(classNode)) + } - return PrimaryConstructor( - builder.build().apply { - containingClassForStaticMemberAttr = currentDispatchReceiverType()!!.lookupTag - }, - valueParameters, - ) + return PrimaryConstructor( + builder.build().apply { + containingClassForStaticMemberAttr = currentDispatchReceiverType()!!.lookupTag + }, + valueParameters, + ) + } } /** @@ -1004,24 +1034,28 @@ class LightTreeRawFirDeclarationBuilder( * at INIT keyword */ private fun convertAnonymousInitializer(anonymousInitializer: LighterASTNode): FirDeclaration { - var firBlock: FirBlock? = null - var modifiers = Modifier() - anonymousInitializer.forEachChildren { - when (it.tokenType) { - MODIFIER_LIST -> modifiers = convertModifierList(it, isInClass = true) - BLOCK -> withForcedLocalContext { - firBlock = convertBlock(it) + val initializerSymbol = FirAnonymousInitializerSymbol() + withContainerSymbol(initializerSymbol) { + var firBlock: FirBlock? = null + var modifiers = Modifier() + anonymousInitializer.forEachChildren { + when (it.tokenType) { + MODIFIER_LIST -> modifiers = convertModifierList(it, isInClass = true) + BLOCK -> withForcedLocalContext { + firBlock = convertBlock(it) + } } } - } - return buildAnonymousInitializer { - source = anonymousInitializer.toFirSourceElement() - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - body = firBlock ?: buildEmptyExpressionBlock() - dispatchReceiverType = context.dispatchReceiverTypesStack.lastOrNull() - annotations += modifiers.annotations + return buildAnonymousInitializer { + symbol = initializerSymbol + source = anonymousInitializer.toFirSourceElement() + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + body = firBlock ?: buildEmptyExpressionBlock() + dispatchReceiverType = context.dispatchReceiverTypesStack.lastOrNull() + annotations += modifiers.annotations + } } } @@ -1035,51 +1069,57 @@ class LightTreeRawFirDeclarationBuilder( var block: LighterASTNode? = null val constructorSymbol = FirConstructorSymbol(callableIdForClassConstructor()) - secondaryConstructor.forEachChildren { - when (it.tokenType) { - MODIFIER_LIST -> modifiers = convertModifierList(it) - VALUE_PARAMETER_LIST -> firValueParameters += convertValueParameters(it, constructorSymbol, ValueParameterDeclaration.FUNCTION) - CONSTRUCTOR_DELEGATION_CALL -> constructorDelegationCall = convertConstructorDelegationCall(it, classWrapper) - BLOCK -> block = it + withContainerSymbol(constructorSymbol) { + secondaryConstructor.forEachChildren { + when (it.tokenType) { + MODIFIER_LIST -> modifiers = convertModifierList(it) + VALUE_PARAMETER_LIST -> firValueParameters += convertValueParameters( + it, + constructorSymbol, + ValueParameterDeclaration.FUNCTION + ) + CONSTRUCTOR_DELEGATION_CALL -> constructorDelegationCall = convertConstructorDelegationCall(it, classWrapper) + BLOCK -> block = it + } } - } - val delegatedSelfTypeRef = classWrapper.delegatedSelfTypeRef + val delegatedSelfTypeRef = classWrapper.delegatedSelfTypeRef - val explicitVisibility = modifiers.getVisibility() - val status = FirDeclarationStatusImpl(explicitVisibility, Modality.FINAL).apply { - isExpect = modifiers.hasExpect() || context.containerIsExpect - isActual = modifiers.hasActual() - isInner = classWrapper.isInner() - isFromSealedClass = classWrapper.isSealed() && explicitVisibility !== Visibilities.Private - isFromEnumClass = classWrapper.isEnum() - } - - val target = FirFunctionTarget(labelName = null, isLambda = false) - return buildConstructor { - source = secondaryConstructor.toFirSourceElement() - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - returnTypeRef = delegatedSelfTypeRef - dispatchReceiverType = classWrapper.obtainDispatchReceiverForConstructor() - this.status = status - symbol = constructorSymbol - delegatedConstructor = constructorDelegationCall - - context.firFunctionTargets += target - annotations += modifiers.annotations - typeParameters += constructorTypeParametersFromConstructedClass(classWrapper.classBuilder.typeParameters) - valueParameters += firValueParameters.map { it.firValueParameter } - val (body, contractDescription) = withForcedLocalContext { - convertFunctionBody(block, null, allowLegacyContractDescription = true) + val explicitVisibility = modifiers.getVisibility() + val status = FirDeclarationStatusImpl(explicitVisibility, Modality.FINAL).apply { + isExpect = modifiers.hasExpect() || context.containerIsExpect + isActual = modifiers.hasActual() + isInner = classWrapper.isInner() + isFromSealedClass = classWrapper.isSealed() && explicitVisibility !== Visibilities.Private + isFromEnumClass = classWrapper.isEnum() + } + + val target = FirFunctionTarget(labelName = null, isLambda = false) + return buildConstructor { + source = secondaryConstructor.toFirSourceElement() + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + returnTypeRef = delegatedSelfTypeRef + dispatchReceiverType = classWrapper.obtainDispatchReceiverForConstructor() + this.status = status + symbol = constructorSymbol + delegatedConstructor = constructorDelegationCall + + context.firFunctionTargets += target + annotations += modifiers.annotations + typeParameters += constructorTypeParametersFromConstructedClass(classWrapper.classBuilder.typeParameters) + valueParameters += firValueParameters.map { it.firValueParameter } + val (body, contractDescription) = withForcedLocalContext { + convertFunctionBody(block, null, allowLegacyContractDescription = true) + } + this.body = body + contractDescription?.let { this.contractDescription = it } + context.firFunctionTargets.removeLast() + this.contextReceivers.addAll(convertContextReceivers(secondaryConstructor.getParent()!!.getParent()!!)) + }.also { + it.containingClassForStaticMemberAttr = currentDispatchReceiverType()!!.lookupTag + target.bind(it) } - this.body = body - contractDescription?.let { this.contractDescription = it } - context.firFunctionTargets.removeLast() - this.contextReceivers.addAll(convertContextReceivers(secondaryConstructor.getParent()!!.getParent()!!)) - }.also { - it.containingClassForStaticMemberAttr = currentDispatchReceiverType()!!.lookupTag - target.bind(it) } } @@ -1148,37 +1188,49 @@ class LightTreeRawFirDeclarationBuilder( typeAlias.forEachChildren { when (it.tokenType) { - MODIFIER_LIST -> modifiers = convertModifierList(it) + MODIFIER_LIST -> modifiers = convertModifierList(it, skipAnnotations = true) IDENTIFIER -> identifier = it.asText - TYPE_REFERENCE -> firType = convertType(it) } } val typeAliasName = identifier.nameAsSafeName() val typeAliasIsExpect = modifiers.hasExpect() || context.containerIsExpect return withChildClassName(typeAliasName, isExpect = typeAliasIsExpect) { - val classSymbol = FirTypeAliasSymbol(context.currentClassId) + val typeAliasSymbol = FirTypeAliasSymbol(context.currentClassId) + withContainerSymbol(typeAliasSymbol) { + typeAlias.forEachChildren { + when (it.tokenType) { + MODIFIER_LIST -> modifiers = convertModifierList(it) + TYPE_REFERENCE -> firType = convertType(it) + } + } - val firTypeParameters = mutableListOf() - typeAlias.forEachChildren { - if (it.tokenType == TYPE_PARAMETER_LIST) { - firTypeParameters += convertTypeParameters(it, emptyList(), classSymbol) + val firTypeParameters = mutableListOf() + typeAlias.forEachChildren { + if (it.tokenType == TYPE_PARAMETER_LIST) { + firTypeParameters += convertTypeParameters(it, emptyList(), typeAliasSymbol) + } } - } - return@withChildClassName buildTypeAlias { - source = typeAlias.toFirSourceElement() - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - name = typeAliasName - val isLocal = context.inLocalContext - status = FirDeclarationStatusImpl(if (isLocal) Visibilities.Local else modifiers.getVisibility(), Modality.FINAL).apply { - isExpect = typeAliasIsExpect - isActual = modifiers.hasActual() + + buildTypeAlias { + source = typeAlias.toFirSourceElement() + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + name = typeAliasName + val isLocal = context.inLocalContext + status = FirDeclarationStatusImpl( + if (isLocal) Visibilities.Local else modifiers.getVisibility(), + Modality.FINAL, + ).apply { + isExpect = typeAliasIsExpect + isActual = modifiers.hasActual() + } + + symbol = typeAliasSymbol + expandedTypeRef = firType + annotations += modifiers.annotations + typeParameters += firTypeParameters } - symbol = classSymbol - expandedTypeRef = firType - annotations += modifiers.annotations - typeParameters += firTypeParameters } } } @@ -1200,165 +1252,174 @@ class LightTreeRawFirDeclarationBuilder( var propertyInitializer: FirExpression? = null var typeParameterList: LighterASTNode? = null var fieldDeclaration: LighterASTNode? = null - property.forEachChildren { - when (it.tokenType) { - MODIFIER_LIST -> modifiers = convertModifierList(it) - IDENTIFIER -> identifier = it.asText - TYPE_PARAMETER_LIST -> typeParameterList = it - COLON -> isReturnType = true - TYPE_REFERENCE -> if (isReturnType) returnType = convertType(it) else receiverType = convertType(it) - TYPE_CONSTRAINT_LIST -> typeConstraints += convertTypeConstraints(it) - PROPERTY_DELEGATE -> delegateExpression = it - VAR_KEYWORD -> isVar = true - PROPERTY_ACCESSOR -> { - accessors += it - } - BACKING_FIELD -> fieldDeclaration = it - else -> if (it.isExpression()) { - context.calleeNamesForLambda += null - propertyInitializer = expressionConverter.getAsFirExpression(it, "Should have initializer") - context.calleeNamesForLambda.removeLast() - } - } + property.getChildNodeByType(IDENTIFIER)?.let { + identifier = it.asText } val propertyName = identifier.nameAsSafeName() - val parentNode = property.getParent() val isLocal = !(parentNode?.tokenType == KT_FILE || parentNode?.tokenType == CLASS_BODY) - val propertySource = property.toFirSourceElement() + val propertySymbol = if (isLocal) { + FirPropertySymbol(propertyName) + } else { + FirPropertySymbol(callableIdForName(propertyName)) + } - return buildProperty { - source = propertySource - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - returnTypeRef = returnType - name = propertyName - this.isVar = isVar - - receiverParameter = receiverType?.convertToReceiverParameter() - initializer = propertyInitializer - - //probably can do this for delegateExpression itself - val delegateSource = delegateExpression?.let { - (it.getExpressionInParentheses() ?: it).toFirSourceElement() - } - - symbol = if (isLocal) FirPropertySymbol(propertyName) else FirPropertySymbol(callableIdForName(propertyName)) - - typeParameterList?.let { firTypeParameters += convertTypeParameters(it, typeConstraints, symbol) } - - backingField = fieldDeclaration.convertBackingField( - symbol, modifiers, returnType, isVar, - if (isLocal) emptyList() else modifiers.annotations.filter { - it.useSiteTarget == FIELD || it.useSiteTarget == PROPERTY_DELEGATE_FIELD - }, - property, - ) - - if (isLocal) { - this.isLocal = true - val delegateBuilder = delegateExpression?.let { - FirWrappedDelegateExpressionBuilder().apply { - source = delegateSource?.fakeElement(KtFakeSourceElementKind.WrappedDelegate) - expression = expressionConverter.getAsFirExpression(it, "Incorrect delegate expression") + withContainerSymbol(propertySymbol, isLocal) { + val propertySource = property.toFirSourceElement() + property.forEachChildren { + when (it.tokenType) { + MODIFIER_LIST -> modifiers = convertModifierList(it) + TYPE_PARAMETER_LIST -> typeParameterList = it + COLON -> isReturnType = true + TYPE_REFERENCE -> if (isReturnType) returnType = convertType(it) else receiverType = convertType(it) + TYPE_CONSTRAINT_LIST -> typeConstraints += convertTypeConstraints(it) + PROPERTY_DELEGATE -> delegateExpression = it + VAR_KEYWORD -> isVar = true + PROPERTY_ACCESSOR -> { + accessors += it + } + BACKING_FIELD -> fieldDeclaration = it + else -> if (it.isExpression()) { + context.calleeNamesForLambda += null + propertyInitializer = expressionConverter.getAsFirExpression(it, "Should have initializer") + context.calleeNamesForLambda.removeLast() } } - status = FirDeclarationStatusImpl(Visibilities.Local, Modality.FINAL).apply { - isLateInit = modifiers.hasLateinit() + } + + return buildProperty { + source = propertySource + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + returnTypeRef = returnType + name = propertyName + this.isVar = isVar + + receiverParameter = receiverType?.convertToReceiverParameter() + initializer = propertyInitializer + + //probably can do this for delegateExpression itself + val delegateSource = delegateExpression?.let { + (it.getExpressionInParentheses() ?: it).toFirSourceElement() } - typeParameters += firTypeParameters - generateAccessorsByDelegate( - delegateBuilder, - baseModuleData, - classWrapper?.classBuilder?.ownerRegularOrAnonymousObjectSymbol, - context = context, - isExtension = false + symbol = propertySymbol + + typeParameterList?.let { firTypeParameters += convertTypeParameters(it, typeConstraints, symbol) } + + backingField = fieldDeclaration.convertBackingField( + symbol, modifiers, returnType, isVar, + if (isLocal) emptyList() else modifiers.annotations.filter { + it.useSiteTarget == FIELD || it.useSiteTarget == PROPERTY_DELEGATE_FIELD + }, + property, ) - } else { - this.isLocal = false - - dispatchReceiverType = currentDispatchReceiverType() - withCapturedTypeParameters(true, propertySource, firTypeParameters) { - typeParameters += firTypeParameters + if (isLocal) { + this.isLocal = true val delegateBuilder = delegateExpression?.let { FirWrappedDelegateExpressionBuilder().apply { source = delegateSource?.fakeElement(KtFakeSourceElementKind.WrappedDelegate) - expression = expressionConverter.getAsFirExpression(it, "Should have delegate") + expression = expressionConverter.getAsFirExpression(it, "Incorrect delegate expression") } } - - val propertyVisibility = modifiers.getVisibility() - - fun defaultAccessorStatus() = - // Downward propagation of `inline` and `external` modifiers (from property to its accessors) - FirDeclarationStatusImpl(propertyVisibility, null).apply { - isInline = modifiers.hasInline() - isExternal = modifiers.hasExternal() - } - - val convertedAccessors = accessors.map { - convertGetterOrSetter(it, returnType, propertyVisibility, symbol, modifiers) + status = FirDeclarationStatusImpl(Visibilities.Local, Modality.FINAL).apply { + isLateInit = modifiers.hasLateinit() } - this.getter = convertedAccessors.find { it.isGetter } - ?: FirDefaultPropertyGetter( - property.toFirSourceElement(KtFakeSourceElementKind.DefaultAccessor), - moduleData, - FirDeclarationOrigin.Source, - returnType.copyWithNewSourceKind(KtFakeSourceElementKind.DefaultAccessor), - propertyVisibility, - symbol, - ).also { - it.status = defaultAccessorStatus() - it.replaceAnnotations(modifiers.annotations.filterUseSiteTarget(PROPERTY_GETTER)) - it.initContainingClassAttr() + + typeParameters += firTypeParameters + generateAccessorsByDelegate( + delegateBuilder, + baseModuleData, + classWrapper?.classBuilder?.ownerRegularOrAnonymousObjectSymbol, + context = context, + isExtension = false + ) + } else { + this.isLocal = false + + dispatchReceiverType = currentDispatchReceiverType() + withCapturedTypeParameters(true, propertySource, firTypeParameters) { + typeParameters += firTypeParameters + + val delegateBuilder = delegateExpression?.let { + FirWrappedDelegateExpressionBuilder().apply { + source = delegateSource?.fakeElement(KtFakeSourceElementKind.WrappedDelegate) + expression = expressionConverter.getAsFirExpression(it, "Should have delegate") + } } - // NOTE: We still need the setter even for a val property so we can report errors (e.g., VAL_WITH_SETTER). - this.setter = convertedAccessors.find { it.isSetter } - ?: if (isVar) { - FirDefaultPropertySetter( + + val propertyVisibility = modifiers.getVisibility() + + fun defaultAccessorStatus() = + // Downward propagation of `inline` and `external` modifiers (from property to its accessors) + FirDeclarationStatusImpl(propertyVisibility, null).apply { + isInline = modifiers.hasInline() + isExternal = modifiers.hasExternal() + } + + val convertedAccessors = accessors.map { + convertGetterOrSetter(it, returnType, propertyVisibility, symbol, modifiers) + } + this.getter = convertedAccessors.find { it.isGetter } + ?: FirDefaultPropertyGetter( property.toFirSourceElement(KtFakeSourceElementKind.DefaultAccessor), moduleData, FirDeclarationOrigin.Source, returnType.copyWithNewSourceKind(KtFakeSourceElementKind.DefaultAccessor), propertyVisibility, symbol, - parameterAnnotations = modifiers.annotations.filterUseSiteTarget(SETTER_PARAMETER) ).also { it.status = defaultAccessorStatus() - it.replaceAnnotations(modifiers.annotations.filterUseSiteTarget(PROPERTY_SETTER)) + it.replaceAnnotations(modifiers.annotations.filterUseSiteTarget(PROPERTY_GETTER)) it.initContainingClassAttr() } - } else null + // NOTE: We still need the setter even for a val property so we can report errors (e.g., VAL_WITH_SETTER). + this.setter = convertedAccessors.find { it.isSetter } + ?: if (isVar) { + FirDefaultPropertySetter( + property.toFirSourceElement(KtFakeSourceElementKind.DefaultAccessor), + moduleData, + FirDeclarationOrigin.Source, + returnType.copyWithNewSourceKind(KtFakeSourceElementKind.DefaultAccessor), + propertyVisibility, + symbol, + parameterAnnotations = modifiers.annotations.filterUseSiteTarget(SETTER_PARAMETER) + ).also { + it.status = defaultAccessorStatus() + it.replaceAnnotations(modifiers.annotations.filterUseSiteTarget(PROPERTY_SETTER)) + it.initContainingClassAttr() + } + } else null - status = FirDeclarationStatusImpl(propertyVisibility, modifiers.getModality(isClassOrObject = false)).apply { - isExpect = modifiers.hasExpect() || context.containerIsExpect - isActual = modifiers.hasActual() - isOverride = modifiers.hasOverride() - isConst = modifiers.isConst() - isLateInit = modifiers.hasLateinit() - isExternal = modifiers.hasExternal() + status = FirDeclarationStatusImpl(propertyVisibility, modifiers.getModality(isClassOrObject = false)).apply { + isExpect = modifiers.hasExpect() || context.containerIsExpect + isActual = modifiers.hasActual() + isOverride = modifiers.hasOverride() + isConst = modifiers.isConst() + isLateInit = modifiers.hasLateinit() + isExternal = modifiers.hasExternal() + } + + generateAccessorsByDelegate( + delegateBuilder, + baseModuleData, + classWrapper?.classBuilder?.ownerRegularOrAnonymousObjectSymbol, + context, + isExtension = receiverType != null, + ) } - - generateAccessorsByDelegate( - delegateBuilder, - baseModuleData, - classWrapper?.classBuilder?.ownerRegularOrAnonymousObjectSymbol, - context, - isExtension = receiverType != null, - ) } - } - annotations += if (isLocal) modifiers.annotations else modifiers.annotations.filter { - it.useSiteTarget != FIELD && it.useSiteTarget != PROPERTY_DELEGATE_FIELD && it.useSiteTarget != PROPERTY_GETTER && - (!isVar || it.useSiteTarget != SETTER_PARAMETER && it.useSiteTarget != PROPERTY_SETTER) - } + annotations += if (isLocal) modifiers.annotations else modifiers.annotations.filter { + it.useSiteTarget != FIELD && it.useSiteTarget != PROPERTY_DELEGATE_FIELD && it.useSiteTarget != PROPERTY_GETTER && + (!isVar || it.useSiteTarget != SETTER_PARAMETER && it.useSiteTarget != PROPERTY_SETTER) + } - contextReceivers.addAll(convertContextReceivers(property)) - }.also { - fillDanglingConstraintsTo(firTypeParameters, typeConstraints, it) + contextReceivers.addAll(convertContextReceivers(property)) + }.also { + fillDanglingConstraintsTo(firTypeParameters, typeConstraints, it) + } } } @@ -1681,134 +1742,144 @@ class LightTreeRawFirDeclarationBuilder( var hasEqToken = false var typeParameterList: LighterASTNode? = null var outerContractDescription: FirContractDescription? = null - functionDeclaration.forEachChildren { - when (it.tokenType) { - MODIFIER_LIST -> modifiers = convertModifierList(it) - IDENTIFIER -> identifier = it.asText - TYPE_PARAMETER_LIST -> typeParameterList = it - VALUE_PARAMETER_LIST -> valueParametersList = it //must convert later, because it can contains "return" - COLON -> isReturnType = true - TYPE_REFERENCE -> if (isReturnType) returnType = convertType(it) else receiverType = convertType(it) - TYPE_CONSTRAINT_LIST -> typeConstraints += convertTypeConstraints(it) - CONTRACT_EFFECT_LIST -> outerContractDescription = obtainContractDescription(it) - BLOCK -> block = it - EQ -> hasEqToken = true - else -> if (it.isExpression()) expression = it - } - } - - if (returnType == null) { - returnType = - if (block != null || !hasEqToken) implicitUnitType - else implicitType + functionDeclaration.getChildNodeByType(IDENTIFIER)?.let { + identifier = it.asText } val parentNode = functionDeclaration.getParent() val isLocal = !(parentNode?.tokenType == KT_FILE || parentNode?.tokenType == CLASS_BODY) - val target: FirFunctionTarget val functionSource = functionDeclaration.toFirSourceElement() - val functionSymbol: FirFunctionSymbol<*> val isAnonymousFunction = identifier == null && isLocal - val functionBuilder = if (isAnonymousFunction) { - functionSymbol = FirAnonymousFunctionSymbol() - FirAnonymousFunctionBuilder().apply { - source = functionSource - receiverParameter = receiverType?.convertToReceiverParameter() - symbol = functionSymbol - isLambda = false - hasExplicitParameterList = true - label = context.getLastLabel(functionDeclaration) - val labelName = label?.name ?: context.calleeNamesForLambda.lastOrNull()?.identifier - target = FirFunctionTarget(labelName = labelName, isLambda = false) - if (modifiers.hasSuspend()) { - status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION - } - } + val functionName = identifier.nameAsSafeName() + val functionSymbol: FirFunctionSymbol<*> = if (isAnonymousFunction) { + FirAnonymousFunctionSymbol() } else { - val functionName = identifier.nameAsSafeName() - val labelName = context.getLastLabel(functionDeclaration)?.name ?: runIf(!functionName.isSpecial) { functionName.identifier } - target = FirFunctionTarget(labelName, isLambda = false) - functionSymbol = FirNamedFunctionSymbol(callableIdForName(functionName)) - FirSimpleFunctionBuilder().apply { - source = functionSource - receiverParameter = receiverType?.convertToReceiverParameter() - name = functionName - status = FirDeclarationStatusImpl( - if (isLocal) Visibilities.Local else modifiers.getVisibility(), - modifiers.getModality(isClassOrObject = false) - ).apply { - isExpect = modifiers.hasExpect() || context.containerIsExpect - isActual = modifiers.hasActual() - isOverride = modifiers.hasOverride() - isOperator = modifiers.hasOperator() - isInfix = modifiers.hasInfix() - isInline = modifiers.hasInline() - isTailRec = modifiers.hasTailrec() - isExternal = modifiers.hasExternal() - isSuspend = modifiers.hasSuspend() - } - - symbol = functionSymbol - dispatchReceiverType = runIf(!isLocal) { currentDispatchReceiverType() } - contextReceivers.addAll(convertContextReceivers(functionDeclaration)) - } + FirNamedFunctionSymbol(callableIdForName(functionName)) } - val firTypeParameters = mutableListOf() - typeParameterList?.let { firTypeParameters += convertTypeParameters(it, typeConstraints, functionSymbol) } - - val function = functionBuilder.apply { - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - returnTypeRef = returnType!! - - context.firFunctionTargets += target - annotations += modifiers.annotations - - val actualTypeParameters = if (this is FirSimpleFunctionBuilder) { - typeParameters += firTypeParameters - typeParameters - } else { - listOf() + withContainerSymbol(functionSymbol, isLocal) { + val target: FirFunctionTarget + functionDeclaration.forEachChildren { + when (it.tokenType) { + MODIFIER_LIST -> modifiers = convertModifierList(it) + TYPE_PARAMETER_LIST -> typeParameterList = it + VALUE_PARAMETER_LIST -> valueParametersList = it //must convert later, because it can contains "return" + COLON -> isReturnType = true + TYPE_REFERENCE -> if (isReturnType) returnType = convertType(it) else receiverType = convertType(it) + TYPE_CONSTRAINT_LIST -> typeConstraints += convertTypeConstraints(it) + CONTRACT_EFFECT_LIST -> outerContractDescription = obtainContractDescription(it) + BLOCK -> block = it + EQ -> hasEqToken = true + else -> if (it.isExpression()) expression = it + } } - withCapturedTypeParameters(true, functionSource, actualTypeParameters) { - valueParametersList?.let { list -> - valueParameters += convertValueParameters( - list, - functionSymbol, - if (isAnonymousFunction) ValueParameterDeclaration.LAMBDA else ValueParameterDeclaration.FUNCTION - ).map { it.firValueParameter } - } + if (returnType == null) { + returnType = + if (block != null || !hasEqToken) implicitUnitType + else implicitType + } - val allowLegacyContractDescription = outerContractDescription == null - val bodyWithContractDescription = withForcedLocalContext { - convertFunctionBody(block, expression, allowLegacyContractDescription) - } - this.body = bodyWithContractDescription.first - val contractDescription = outerContractDescription ?: bodyWithContractDescription.second - contractDescription?.let { - if (this is FirSimpleFunctionBuilder) { - this.contractDescription = it - } else if (this is FirAnonymousFunctionBuilder) { - this.contractDescription = it + val functionBuilder = if (isAnonymousFunction) { + FirAnonymousFunctionBuilder().apply { + source = functionSource + receiverParameter = receiverType?.convertToReceiverParameter() + symbol = functionSymbol as FirAnonymousFunctionSymbol + isLambda = false + hasExplicitParameterList = true + label = context.getLastLabel(functionDeclaration) + val labelName = label?.name ?: context.calleeNamesForLambda.lastOrNull()?.identifier + target = FirFunctionTarget(labelName = labelName, isLambda = false) + if (modifiers.hasSuspend()) { + status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION } } + } else { + val labelName = + context.getLastLabel(functionDeclaration)?.name ?: runIf(!functionName.isSpecial) { functionName.identifier } + target = FirFunctionTarget(labelName, isLambda = false) + FirSimpleFunctionBuilder().apply { + source = functionSource + receiverParameter = receiverType?.convertToReceiverParameter() + name = functionName + status = FirDeclarationStatusImpl( + if (isLocal) Visibilities.Local else modifiers.getVisibility(), + modifiers.getModality(isClassOrObject = false) + ).apply { + isExpect = modifiers.hasExpect() || context.containerIsExpect + isActual = modifiers.hasActual() + isOverride = modifiers.hasOverride() + isOperator = modifiers.hasOperator() + isInfix = modifiers.hasInfix() + isInline = modifiers.hasInline() + isTailRec = modifiers.hasTailrec() + isExternal = modifiers.hasExternal() + isSuspend = modifiers.hasSuspend() + } + + symbol = functionSymbol as FirNamedFunctionSymbol + dispatchReceiverType = runIf(!isLocal) { currentDispatchReceiverType() } + contextReceivers.addAll(convertContextReceivers(functionDeclaration)) + } } - context.firFunctionTargets.removeLast() - }.build().also { - target.bind(it) - if (it is FirSimpleFunction) { - fillDanglingConstraintsTo(firTypeParameters, typeConstraints, it) + + val firTypeParameters = mutableListOf() + typeParameterList?.let { firTypeParameters += convertTypeParameters(it, typeConstraints, functionSymbol) } + + val function = functionBuilder.apply { + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + returnTypeRef = returnType!! + + context.firFunctionTargets += target + annotations += modifiers.annotations + + val actualTypeParameters = if (this is FirSimpleFunctionBuilder) { + typeParameters += firTypeParameters + typeParameters + } else { + listOf() + } + + withCapturedTypeParameters(true, functionSource, actualTypeParameters) { + valueParametersList?.let { list -> + valueParameters += convertValueParameters( + list, + functionSymbol, + if (isAnonymousFunction) ValueParameterDeclaration.LAMBDA else ValueParameterDeclaration.FUNCTION + ).map { it.firValueParameter } + } + + val allowLegacyContractDescription = outerContractDescription == null + val bodyWithContractDescription = withForcedLocalContext { + convertFunctionBody(block, expression, allowLegacyContractDescription) + } + this.body = bodyWithContractDescription.first + val contractDescription = outerContractDescription ?: bodyWithContractDescription.second + contractDescription?.let { + if (this is FirSimpleFunctionBuilder) { + this.contractDescription = it + } else if (this is FirAnonymousFunctionBuilder) { + this.contractDescription = it + } + } + } + context.firFunctionTargets.removeLast() + }.build().also { + target.bind(it) + if (it is FirSimpleFunction) { + fillDanglingConstraintsTo(firTypeParameters, typeConstraints, it) + } } - } - return if (function is FirAnonymousFunction) { - buildAnonymousFunctionExpression { - source = functionSource - anonymousFunction = function + + return if (function is FirAnonymousFunction) { + buildAnonymousFunctionExpression { + source = functionSource + anonymousFunction = function + } + } else { + function } - } else { - function } } diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/DestructuringDeclaration.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/DestructuringDeclaration.kt index 9f47e9f6b0a..db8f99c7ecf 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/DestructuringDeclaration.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/DestructuringDeclaration.kt @@ -7,15 +7,19 @@ package org.jetbrains.kotlin.fir.lightTree.fir import org.jetbrains.kotlin.KtSourceElement import org.jetbrains.kotlin.fir.FirModuleData +import org.jetbrains.kotlin.fir.builder.AbstractRawFirBuilder import org.jetbrains.kotlin.fir.builder.DestructuringContext import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder import org.jetbrains.kotlin.fir.builder.addDestructuringStatements import org.jetbrains.kotlin.fir.declarations.FirVariable import org.jetbrains.kotlin.fir.expressions.FirAnnotation +import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirStatement +import org.jetbrains.kotlin.fir.expressions.builder.buildAnnotationCallCopy import org.jetbrains.kotlin.fir.expressions.builder.buildBlock import org.jetbrains.kotlin.fir.generateTemporaryVariable +import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.SpecialNames @@ -27,6 +31,7 @@ data class DestructuringDeclaration( val source: KtSourceElement, val annotations: List, ) { + context(AbstractRawFirBuilder<*>) fun toFirDestructingDeclaration( moduleData: FirModuleData, tmpVariable: Boolean = true, @@ -49,19 +54,24 @@ class DestructuringEntry( val source: KtSourceElement, val returnTypeRef: FirTypeRef, val name: Name, - val annotations: List, + val annotations: List, ) { @Suppress("EXTENSION_SHADOWED_BY_MEMBER") companion object : DestructuringContext { override val DestructuringEntry.returnTypeRef: FirTypeRef get() = returnTypeRef override val DestructuringEntry.name: Name get() = name override val DestructuringEntry.source: KtSourceElement get() = source - override fun DestructuringEntry.extractAnnotationsTo(target: FirAnnotationContainerBuilder) { - target.annotations += annotations + override fun DestructuringEntry.extractAnnotationsTo(target: FirAnnotationContainerBuilder, containerSymbol: FirBasedSymbol<*>) { + target.annotations += annotations.map { + buildAnnotationCallCopy(it) { + containingDeclarationSymbol = containerSymbol + } + } } } } +context(AbstractRawFirBuilder<*>) fun MutableList.addDestructuringStatements( moduleData: FirModuleData, multiDeclaration: DestructuringDeclaration, diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt index d72f4e27db2..11cd4bd1d36 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ValueParameter.kt @@ -32,6 +32,7 @@ import org.jetbrains.kotlin.fir.declarations.utils.isFromVararg import org.jetbrains.kotlin.fir.diagnostics.ConeSyntaxDiagnostic import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.expressions.FirExpression +import org.jetbrains.kotlin.fir.expressions.builder.buildAnnotationCallCopy import org.jetbrains.kotlin.fir.expressions.builder.buildPropertyAccessExpression import org.jetbrains.kotlin.fir.lightTree.fir.modifier.Modifier import org.jetbrains.kotlin.fir.references.builder.buildPropertyFromParameterResolvedNamedReference @@ -128,8 +129,16 @@ class ValueParameter( source = propertySource } } + isVar = this@ValueParameter.isVar - symbol = FirPropertySymbol(callableId) + val propertySymbol = FirPropertySymbol(callableId) + val remappedAnnotations = modifiers.annotations.map { + buildAnnotationCallCopy(it) { + containingDeclarationSymbol = propertySymbol + } + } + + symbol = propertySymbol dispatchReceiverType = currentDispatchReceiver isLocal = false status = FirDeclarationStatusImpl(modifiers.getVisibility(), modifiers.getModality(isClassOrObject = false)).apply { @@ -145,7 +154,7 @@ class ValueParameter( moduleData = moduleData, origin = FirDeclarationOrigin.Source, source = defaultAccessorSource, - annotations = modifiers.annotations.filter { + annotations = remappedAnnotations.filter { it.useSiteTarget == FIELD || it.useSiteTarget == PROPERTY_DELEGATE_FIELD }.toMutableList(), returnTypeRef = returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.DefaultAccessor), @@ -154,7 +163,7 @@ class ValueParameter( status = status.copy(isLateInit = false), ) - annotations += modifiers.annotations.filter { + annotations += remappedAnnotations.filter { it.useSiteTarget == null || it.useSiteTarget == PROPERTY } @@ -168,7 +177,7 @@ class ValueParameter( isInline = modifiers.hasInline(), ).also { it.initContainingClassAttr(context) - it.replaceAnnotations(modifiers.annotations.filterUseSiteTarget(PROPERTY_GETTER)) + it.replaceAnnotations(remappedAnnotations.filterUseSiteTarget(PROPERTY_GETTER)) } setter = if (this.isVar) FirDefaultPropertySetter( defaultAccessorSource, @@ -177,11 +186,11 @@ class ValueParameter( type.copyWithNewSourceKind(KtFakeSourceElementKind.DefaultAccessor), modifiers.getVisibility(), symbol, - parameterAnnotations = modifiers.annotations.filterUseSiteTarget(SETTER_PARAMETER), + parameterAnnotations = remappedAnnotations.filterUseSiteTarget(SETTER_PARAMETER), isInline = modifiers.hasInline(), ).also { it.initContainingClassAttr(context) - it.replaceAnnotations(modifiers.annotations.filterUseSiteTarget(PROPERTY_SETTER)) + it.replaceAnnotations(remappedAnnotations.filterUseSiteTarget(PROPERTY_SETTER)) } else null }.apply { if (firValueParameter.isVararg) { diff --git a/compiler/fir/raw-fir/light-tree2fir/tests/org/jetbrains/kotlin/fir/lightTree/AbstractLightTree2FirConverterTestCase.kt b/compiler/fir/raw-fir/light-tree2fir/tests/org/jetbrains/kotlin/fir/lightTree/AbstractLightTree2FirConverterTestCase.kt index 81b6e2cd154..35ada9a3969 100644 --- a/compiler/fir/raw-fir/light-tree2fir/tests/org/jetbrains/kotlin/fir/lightTree/AbstractLightTree2FirConverterTestCase.kt +++ b/compiler/fir/raw-fir/light-tree2fir/tests/org/jetbrains/kotlin/fir/lightTree/AbstractLightTree2FirConverterTestCase.kt @@ -1,6 +1,6 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.fir.lightTree @@ -24,7 +24,8 @@ abstract class AbstractLightTree2FirConverterTestCase : AbstractRawFirBuilderTes ).buildFirFile(Paths.get(filePath)) val firDump = FirRenderer.withDeclarationAttributes().renderElementAsString(firFile) - val expectedFile = File(filePath.replace(".kt", ".txt")) + val expectedFile = File(expectedPath(filePath, ".txt")) KotlinTestUtils.assertEqualsToFile(expectedFile, firDump) + checkAnnotationOwners(filePath, firFile) } } diff --git a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiConversionUtils.kt b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiConversionUtils.kt index 9387b7f02ed..520e18eb9fe 100644 --- a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiConversionUtils.kt +++ b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiConversionUtils.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -119,7 +119,7 @@ internal fun generateTemporaryVariable( extractAnnotationsTo, ) -context(DestructuringContext) +context(AbstractRawFirBuilder<*>, DestructuringContext) internal fun generateDestructuringBlock( moduleData: FirModuleData, multiDeclaration: KtDestructuringDeclaration, @@ -139,7 +139,7 @@ internal fun generateDestructuringBlock( } } -context(DestructuringContext) +context(AbstractRawFirBuilder<*>, DestructuringContext) internal fun MutableList.addDestructuringStatements( moduleData: FirModuleData, multiDeclaration: KtDestructuringDeclaration, diff --git a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiRawFirBuilder.kt b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiRawFirBuilder.kt index e12880bdf0c..8e3b27d8259 100644 --- a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiRawFirBuilder.kt +++ b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiRawFirBuilder.kt @@ -84,8 +84,10 @@ open class PsiRawFirBuilder( return runOnStubs { file.accept(Visitor(), null) as FirFile } } - fun buildAnnotationCall(annotation: KtAnnotationEntry): FirAnnotationCall { - return Visitor().visitAnnotationEntry(annotation, null) as FirAnnotationCall + fun buildAnnotationCall(annotation: KtAnnotationEntry, containerSymbol: FirBasedSymbol<*>): FirAnnotationCall { + return withContainerSymbol(containerSymbol) { + Visitor().visitAnnotationEntry(annotation, null) as FirAnnotationCall + } } override fun PsiElement.toFirSourceElement(kind: KtFakeSourceElementKind?): KtPsiSourceElement { @@ -183,7 +185,10 @@ open class PsiRawFirBuilder( override val KtDestructuringDeclarationEntry.source: KtSourceElement get() = toKtPsiSourceElement() - override fun KtDestructuringDeclarationEntry.extractAnnotationsTo(target: FirAnnotationContainerBuilder) { + override fun KtDestructuringDeclarationEntry.extractAnnotationsTo( + target: FirAnnotationContainerBuilder, + containerSymbol: FirBasedSymbol<*>, + ) { (this as KtAnnotated).extractAnnotationsTo(target) } @@ -276,7 +281,7 @@ open class PsiRawFirBuilder( valueParameter.toFirValueParameter(defaultTypeRef, functionSymbol, valueParameterDeclaration, additionalAnnotations) private fun KtTypeReference?.toFirOrImplicitType(): FirTypeRef = - this?.toFirOrErrorType() ?: FirImplicitTypeRefImplWithoutSource + this?.toFirType() ?: FirImplicitTypeRefImplWithoutSource private fun KtTypeReference?.toFirOrUnitType(): FirTypeRef = this?.toFirType() ?: implicitUnitType @@ -705,81 +710,84 @@ open class PsiRawFirBuilder( isLateInit = hasModifier(LATEINIT_KEYWORD) } - val propertySource = toFirSourceElement(KtFakeSourceElementKind.PropertyFromParameter) val propertyName = nameAsSafeName - val parameterAnnotations = mutableListOf() - for (annotationEntry in annotationEntries) { - parameterAnnotations += annotationEntry.convert() - } + val propertySymbol = FirPropertySymbol(callableIdForName(propertyName)) + withContainerSymbol(propertySymbol) { + val propertySource = toFirSourceElement(KtFakeSourceElementKind.PropertyFromParameter) + val parameterAnnotations = mutableListOf() + for (annotationEntry in annotationEntries) { + parameterAnnotations += annotationEntry.convert() + } - return buildProperty { - source = propertySource - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - returnTypeRef = firParameter.returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.PropertyFromParameter) - name = propertyName - initializer = buildPropertyAccessExpression { + return buildProperty { source = propertySource - calleeReference = buildPropertyFromParameterResolvedNamedReference { + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + returnTypeRef = firParameter.returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.PropertyFromParameter) + name = propertyName + initializer = buildPropertyAccessExpression { source = propertySource - name = propertyName - resolvedSymbol = firParameter.symbol + calleeReference = buildPropertyFromParameterResolvedNamedReference { + source = propertySource + name = propertyName + resolvedSymbol = firParameter.symbol + } } - } - isVar = isMutable - symbol = FirPropertySymbol(callableIdForName(propertyName)) - isLocal = false - val defaultAccessorSource = propertySource.fakeElement(KtFakeSourceElementKind.DefaultAccessor) - backingField = FirDefaultPropertyBackingField( - moduleData = baseModuleData, - origin = FirDeclarationOrigin.Source, - source = defaultAccessorSource, - annotations = parameterAnnotations.filter { - it.useSiteTarget == FIELD || it.useSiteTarget == PROPERTY_DELEGATE_FIELD - }.toMutableList(), - returnTypeRef = returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.DefaultAccessor), - isVar = isVar, - propertySymbol = symbol, - status = status.copy(isLateInit = false), - ) + isVar = isMutable + symbol = propertySymbol + isLocal = false + val defaultAccessorSource = propertySource.fakeElement(KtFakeSourceElementKind.DefaultAccessor) + backingField = FirDefaultPropertyBackingField( + moduleData = baseModuleData, + origin = FirDeclarationOrigin.Source, + source = defaultAccessorSource, + annotations = parameterAnnotations.filter { + it.useSiteTarget == FIELD || it.useSiteTarget == PROPERTY_DELEGATE_FIELD + }.toMutableList(), + returnTypeRef = returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.DefaultAccessor), + isVar = isVar, + propertySymbol = symbol, + status = status.copy(isLateInit = false), + ) - this.status = status - getter = FirDefaultPropertyGetter( - defaultAccessorSource, - baseModuleData, - FirDeclarationOrigin.Source, - returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.DefaultAccessor), - visibility, - symbol, - isInline = hasModifier(INLINE_KEYWORD), - ).also { getter -> - getter.initContainingClassAttr() - getter.replaceAnnotations(parameterAnnotations.filterUseSiteTarget(PROPERTY_GETTER)) - } - setter = if (isMutable) FirDefaultPropertySetter( - defaultAccessorSource, - baseModuleData, - FirDeclarationOrigin.Source, - returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.DefaultAccessor), - visibility, - symbol, - parameterAnnotations = parameterAnnotations.filterUseSiteTarget(SETTER_PARAMETER), - isInline = hasModifier(INLINE_KEYWORD), - ).also { setter -> - setter.initContainingClassAttr() - setter.replaceAnnotations(parameterAnnotations.filterUseSiteTarget(PROPERTY_SETTER)) - } else null - annotations += parameterAnnotations.filter { - it.useSiteTarget == null || it.useSiteTarget == PROPERTY - } + this.status = status + getter = FirDefaultPropertyGetter( + defaultAccessorSource, + baseModuleData, + FirDeclarationOrigin.Source, + returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.DefaultAccessor), + visibility, + symbol, + isInline = hasModifier(INLINE_KEYWORD), + ).also { getter -> + getter.initContainingClassAttr() + getter.replaceAnnotations(parameterAnnotations.filterUseSiteTarget(PROPERTY_GETTER)) + } + setter = if (isMutable) FirDefaultPropertySetter( + defaultAccessorSource, + baseModuleData, + FirDeclarationOrigin.Source, + returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.DefaultAccessor), + visibility, + symbol, + parameterAnnotations = parameterAnnotations.filterUseSiteTarget(SETTER_PARAMETER), + isInline = hasModifier(INLINE_KEYWORD), + ).also { setter -> + setter.initContainingClassAttr() + setter.replaceAnnotations(parameterAnnotations.filterUseSiteTarget(PROPERTY_SETTER)) + } else null + annotations += parameterAnnotations.filter { + it.useSiteTarget == null || it.useSiteTarget == PROPERTY + } - dispatchReceiverType = currentDispatchReceiverType() - }.apply { - if (firParameter.isVararg) { - isFromVararg = true + dispatchReceiverType = currentDispatchReceiverType() + }.apply { + if (firParameter.isVararg) { + isFromVararg = true + } + firParameter.correspondingProperty = this + fromPrimaryConstructor = true } - firParameter.correspondingProperty = this - fromPrimaryConstructor = true } } @@ -862,6 +870,7 @@ open class PsiRawFirBuilder( } entry.extractArgumentsTo(this) typeArguments.appendTypeArguments(entry.typeArguments) + containingDeclarationSymbol = this@buildTypeParameter.symbol } } } @@ -922,7 +931,16 @@ open class PsiRawFirBuilder( container.argumentList = argumentList } - protected fun buildFieldForSupertypeDelegate(entry: KtDelegatedSuperTypeEntry, type: FirTypeRef, fieldOrd: Int): FirField { + /** + * @param type the return type for new field. + * In the case of null will be calculated inside [withContainerSymbol], + * so it is crucial to decide to whom type annotation will be belonged + */ + protected fun buildFieldForSupertypeDelegate( + entry: KtDelegatedSuperTypeEntry, + type: FirTypeRef?, + fieldOrd: Int, + ): FirField { val delegateSource = entry.toFirSourceElement(KtFakeSourceElementKind.ClassDelegationField) val delegateExpression = buildOrLazyExpression(delegateSource) { @@ -934,8 +952,11 @@ open class PsiRawFirBuilder( moduleData = baseModuleData origin = FirDeclarationOrigin.Synthetic.DelegateField name = NameUtils.delegateFieldName(fieldOrd) - returnTypeRef = type symbol = FirFieldSymbol(CallableId(this@PsiRawFirBuilder.context.currentClassId, name)) + returnTypeRef = type ?: withContainerSymbol(symbol) { + entry.typeReference.toFirOrErrorType() + } + isVar = false status = FirDeclarationStatusImpl(Visibilities.Private, Modality.FINAL) initializer = delegateExpression @@ -969,6 +990,10 @@ open class PsiRawFirBuilder( is KtDelegatedSuperTypeEntry -> { val type = superTypeListEntry.typeReference.toFirOrErrorType() container.superTypeRefs += type + + /** + * [FirAnnotationCall.containingDeclarationSymbol] have to be from [container], so we should calculate it here + */ val delegateField = buildFieldForSupertypeDelegate(superTypeListEntry, type, delegateFieldsMap.size) delegateFieldsMap[index] = delegateField.symbol } @@ -1075,83 +1100,94 @@ open class PsiRawFirBuilder( isImplicitlyActual: Boolean = false, isKotlinAny: Boolean = false, ): FirConstructor { - val constructorSource = this?.toFirSourceElement() - ?: owner.toKtPsiSourceElement(KtFakeSourceElementKind.ImplicitConstructor) + val constructorSymbol = FirConstructorSymbol(callableIdForClassConstructor()) + withContainerSymbol(constructorSymbol) { + val constructorSource = this?.toFirSourceElement() + ?: owner.toKtPsiSourceElement(KtFakeSourceElementKind.ImplicitConstructor) - fun buildDelegatedCall(superTypeCallEntry: KtSuperTypeCallEntry?, delegatedTypeRef: FirTypeRef): FirDelegatedConstructorCall? { - val constructorCall = superTypeCallEntry?.toFirSourceElement() - val constructedTypeRef = if (copyConstructedTypeRefWithImplicitSource) { - delegatedTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.ImplicitTypeRef) - } else { - delegatedTypeRef - } - return buildOrLazyDelegatedConstructorCall(isThis = false, constructedTypeRef) { - buildDelegatedConstructorCall { - source = constructorCall ?: constructorSource.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall) - this.constructedTypeRef = constructedTypeRef - isThis = false - calleeReference = buildExplicitSuperReference { - source = - superTypeCallEntry?.calleeExpression?.toFirSourceElement(KtFakeSourceElementKind.DelegatingConstructorCall) - ?: this@buildDelegatedConstructorCall.source?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall) - superTypeRef = this@buildDelegatedConstructorCall.constructedTypeRef - } - superTypeCallEntry?.extractArgumentsTo(this) + fun buildDelegatedCall( + superTypeCallEntry: KtSuperTypeCallEntry?, + delegatedTypeRef: FirTypeRef, + ): FirDelegatedConstructorCall? { + val constructorCall = superTypeCallEntry?.toFirSourceElement() + val constructedTypeRef = if (copyConstructedTypeRefWithImplicitSource) { + delegatedTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.ImplicitTypeRef) + } else { + delegatedTypeRef } - } - } - - val firDelegatedCall = runUnless(containingClassIsExpectClass || isKotlinAny) { - if (allSuperTypeCallEntries.size <= 1) { - buildDelegatedCall(superTypeCallEntry, delegatedSuperTypeRef!!) - } else { - buildMultiDelegatedConstructorCall { - allSuperTypeCallEntries.mapTo(delegatedConstructorCalls) { (superTypeCallEntry, delegatedTypeRef) -> - buildDelegatedCall(superTypeCallEntry, delegatedTypeRef)!! + return buildOrLazyDelegatedConstructorCall(isThis = false, constructedTypeRef) { + buildDelegatedConstructorCall { + source = constructorCall ?: constructorSource.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall) + this.constructedTypeRef = constructedTypeRef + isThis = false + calleeReference = buildExplicitSuperReference { + source = + superTypeCallEntry?.calleeExpression?.toFirSourceElement(KtFakeSourceElementKind.DelegatingConstructorCall) + ?: this@buildDelegatedConstructorCall.source?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall) + superTypeRef = this@buildDelegatedConstructorCall.constructedTypeRef + } + superTypeCallEntry?.extractArgumentsTo(this) } } } - } - // See DescriptorUtils#getDefaultConstructorVisibility in core.descriptors - fun defaultVisibility() = when { - owner is KtObjectDeclaration || owner.hasModifier(ENUM_KEYWORD) || owner is KtEnumEntry -> Visibilities.Private - owner.hasModifier(SEALED_KEYWORD) -> Visibilities.Protected - else -> Visibilities.Unknown - } + val firDelegatedCall = runUnless(containingClassIsExpectClass || isKotlinAny) { + if (allSuperTypeCallEntries.size <= 1) { + buildDelegatedCall(superTypeCallEntry, delegatedSuperTypeRef!!) + } else { + buildMultiDelegatedConstructorCall { + allSuperTypeCallEntries.mapTo(delegatedConstructorCalls) { (superTypeCallEntry, delegatedTypeRef) -> + buildDelegatedCall(superTypeCallEntry, delegatedTypeRef)!! + } + } + } + } - val explicitVisibility = this?.visibility?.takeUnless { it == Visibilities.Unknown } - val status = FirDeclarationStatusImpl(explicitVisibility ?: defaultVisibility(), Modality.FINAL).apply { - isExpect = this@toFirConstructor?.hasExpectModifier() == true || this@PsiRawFirBuilder.context.containerIsExpect - isActual = this@toFirConstructor?.hasActualModifier() == true || isImplicitlyActual + // See DescriptorUtils#getDefaultConstructorVisibility in core.descriptors + fun defaultVisibility() = when { + owner is KtObjectDeclaration || owner.hasModifier(ENUM_KEYWORD) || owner is KtEnumEntry -> Visibilities.Private + owner.hasModifier(SEALED_KEYWORD) -> Visibilities.Protected + else -> Visibilities.Unknown + } - // a warning about inner script class is reported on the class itself - isInner = owner.parent.parent !is KtScript && owner.hasModifier(INNER_KEYWORD) - isFromSealedClass = owner.hasModifier(SEALED_KEYWORD) && explicitVisibility !== Visibilities.Private - isFromEnumClass = owner.hasModifier(ENUM_KEYWORD) - } + val explicitVisibility = this?.visibility?.takeUnless { it == Visibilities.Unknown } + val status = FirDeclarationStatusImpl(explicitVisibility ?: defaultVisibility(), Modality.FINAL).apply { + isExpect = this@toFirConstructor?.hasExpectModifier() == true || this@PsiRawFirBuilder.context.containerIsExpect + isActual = this@toFirConstructor?.hasActualModifier() == true || isImplicitlyActual - val builder = when { - this?.modifierList != null && getConstructorKeyword() == null -> createErrorConstructorBuilder(ConeMissingConstructorKeyword) - isErrorConstructor -> createErrorConstructorBuilder(ConeNoConstructorError) - else -> FirPrimaryConstructorBuilder() + // a warning about inner script class is reported on the class itself + isInner = owner.parent.parent !is KtScript && owner.hasModifier(INNER_KEYWORD) + isFromSealedClass = owner.hasModifier(SEALED_KEYWORD) && explicitVisibility !== Visibilities.Private + isFromEnumClass = owner.hasModifier(ENUM_KEYWORD) + } + + val builder = when { + this?.modifierList != null && + getConstructorKeyword() == null -> createErrorConstructorBuilder(ConeMissingConstructorKeyword) + isErrorConstructor -> createErrorConstructorBuilder(ConeNoConstructorError) + else -> FirPrimaryConstructorBuilder() + } + + builder.apply { + source = constructorSource + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + returnTypeRef = delegatedSelfTypeRef + this.status = status + dispatchReceiverType = owner.obtainDispatchReceiverForConstructor() + symbol = constructorSymbol + delegatedConstructor = firDelegatedCall + typeParameters += constructorTypeParametersFromConstructedClass(ownerTypeParameters) + this.contextReceivers.addAll(convertContextReceivers(owner.contextReceivers)) + this@toFirConstructor?.extractAnnotationsTo(this) + this@toFirConstructor?.extractValueParametersTo(this, symbol, ValueParameterDeclaration.PRIMARY_CONSTRUCTOR) + this.body = null + } + + return builder.build().apply { + containingClassForStaticMemberAttr = currentDispatchReceiverType()!!.lookupTag + } } - builder.apply { - source = constructorSource - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - returnTypeRef = delegatedSelfTypeRef - this.status = status - dispatchReceiverType = owner.obtainDispatchReceiverForConstructor() - symbol = FirConstructorSymbol(callableIdForClassConstructor()) - delegatedConstructor = firDelegatedCall - typeParameters += constructorTypeParametersFromConstructedClass(ownerTypeParameters) - this.contextReceivers.addAll(convertContextReceivers(owner.contextReceivers)) - this@toFirConstructor?.extractAnnotationsTo(this) - this@toFirConstructor?.extractValueParametersTo(this, symbol, ValueParameterDeclaration.PRIMARY_CONSTRUCTOR) - this.body = null - } - return builder.build().apply { containingClassForStaticMemberAttr = currentDispatchReceiverType()!!.lookupTag } } private fun KtClassOrObject.obtainDispatchReceiverForConstructor(): ConeClassLikeType? = @@ -1179,8 +1215,10 @@ open class PsiRawFirBuilder( moduleData = baseModuleData containingFileSymbol = this@buildFile.symbol source = it.toKtPsiSourceElement() - for (annotationEntry in it.annotationEntries) { - annotations += annotationEntry.convert() + withContainerSymbol(containingFileSymbol) { + for (annotationEntry in it.annotationEntries) { + annotations += annotationEntry.convert() + } } annotations.ifEmpty { @@ -1235,13 +1273,13 @@ open class PsiRawFirBuilder( fileName: String, sourceFile: KtSourceFile?, setup: FirScriptBuilder.() -> Unit = {}, - ): FirScript { - return buildScript { - source = script.toFirSourceElement() - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - name = Name.special("") - symbol = FirScriptSymbol(context.packageFqName.child(name)) + ): FirScript = buildScript { + source = script.toFirSourceElement() + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + name = Name.special("") + symbol = FirScriptSymbol(context.packageFqName.child(name)) + withContainerSymbol(symbol) { for (declaration in script.declarations) { when (declaration) { is KtScriptInitializer -> { @@ -1291,11 +1329,13 @@ open class PsiRawFirBuilder( moduleData = baseModuleData origin = FirDeclarationOrigin.Source symbol = FirCodeFragmentSymbol() - block = buildOrLazyBlock { - when (file) { - is KtExpressionCodeFragment -> file.getContentElement()?.toFirBlock() ?: buildEmptyExpressionBlock() - is KtBlockCodeFragment -> configureBlockWithoutBuilding(file.getContentElement()).build() - else -> error("Unexpected code fragment type: ${file::class}") + withContainerSymbol(symbol) { + block = buildOrLazyBlock { + when (file) { + is KtExpressionCodeFragment -> file.getContentElement()?.toFirBlock() ?: buildEmptyExpressionBlock() + is KtBlockCodeFragment -> configureBlockWithoutBuilding(file.getContentElement()).build() + else -> error("Unexpected code fragment type: ${file::class}") + } } } } @@ -1314,81 +1354,84 @@ open class PsiRawFirBuilder( ): FirDeclaration { val ktEnumEntry = this@toFirEnumEntry val containingClassIsExpectClass = hasExpectModifier() || this@PsiRawFirBuilder.context.containerIsExpect - return buildEnumEntry { - source = toFirSourceElement() - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - returnTypeRef = delegatedEnumSelfTypeRef - name = nameAsSafeName - status = FirDeclarationStatusImpl(Visibilities.Public, Modality.FINAL).apply { - isStatic = true - isExpect = containingClassIsExpectClass - } - symbol = FirEnumEntrySymbol(callableIdForName(nameAsSafeName)) - if (ownerClassHasDefaultConstructor && ktEnumEntry.initializerList == null && - ktEnumEntry.annotationEntries.isEmpty() && ktEnumEntry.body == null - ) { - return@buildEnumEntry - } - extractAnnotationsTo(this) - initializer = buildOrLazyExpression(toFirSourceElement(KtFakeSourceElementKind.EnumInitializer)) { - withChildClassName(nameAsSafeName, isExpect = false) { - buildAnonymousObjectExpression { - val enumEntrySource = toFirSourceElement(KtFakeSourceElementKind.EnumInitializer) - source = enumEntrySource - anonymousObject = buildAnonymousObject { + val enumSymbol = FirEnumEntrySymbol(callableIdForName(nameAsSafeName)) + return withContainerSymbol(enumSymbol) { + buildEnumEntry { + source = toFirSourceElement() + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + returnTypeRef = delegatedEnumSelfTypeRef + name = nameAsSafeName + status = FirDeclarationStatusImpl(Visibilities.Public, Modality.FINAL).apply { + isStatic = true + isExpect = containingClassIsExpectClass + } + symbol = enumSymbol + if (ownerClassHasDefaultConstructor && ktEnumEntry.initializerList == null && + ktEnumEntry.annotationEntries.isEmpty() && ktEnumEntry.body == null + ) { + return@buildEnumEntry + } + extractAnnotationsTo(this) + initializer = buildOrLazyExpression(toFirSourceElement(KtFakeSourceElementKind.EnumInitializer)) { + withChildClassName(nameAsSafeName, isExpect = false) { + buildAnonymousObjectExpression { + val enumEntrySource = toFirSourceElement(KtFakeSourceElementKind.EnumInitializer) source = enumEntrySource - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - classKind = ClassKind.ENUM_ENTRY - scopeProvider = this@PsiRawFirBuilder.baseScopeProvider - symbol = FirAnonymousObjectSymbol(this@PsiRawFirBuilder.context.packageFqName) - status = FirDeclarationStatusImpl(Visibilities.Local, Modality.FINAL) + anonymousObject = buildAnonymousObject { + source = enumEntrySource + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + classKind = ClassKind.ENUM_ENTRY + scopeProvider = this@PsiRawFirBuilder.baseScopeProvider + symbol = FirAnonymousObjectSymbol(this@PsiRawFirBuilder.context.packageFqName) + status = FirDeclarationStatusImpl(Visibilities.Local, Modality.FINAL) - val delegatedEntrySelfType = buildResolvedTypeRef { - type = - ConeClassLikeTypeImpl( - this@buildAnonymousObject.symbol.toLookupTag(), - emptyArray(), - isNullable = false - ) - } - registerSelfType(delegatedEntrySelfType) + val delegatedEntrySelfType = buildResolvedTypeRef { + type = + ConeClassLikeTypeImpl( + this@buildAnonymousObject.symbol.toLookupTag(), + emptyArray(), + isNullable = false + ) + } + registerSelfType(delegatedEntrySelfType) - superTypeRefs += delegatedEnumSelfTypeRef - val superTypeCallEntry = superTypeListEntries.firstIsInstanceOrNull() - val correctedEnumSelfTypeRef = buildResolvedTypeRef { - source = superTypeCallEntry?.calleeExpression?.typeReference?.toFirSourceElement() - type = delegatedEnumSelfTypeRef.type - } - declarations += primaryConstructor.toFirConstructor( - superTypeCallEntry, - correctedEnumSelfTypeRef, - delegatedEntrySelfType, - owner = ktEnumEntry, - typeParameters, - allSuperTypeCallEntries = emptyList(), - containingClassIsExpectClass, - copyConstructedTypeRefWithImplicitSource = true, - ) - // Use ANONYMOUS_OBJECT_NAME for the owner class id for enum entry declarations (see KT-42351) - withChildClassName(SpecialNames.ANONYMOUS, forceLocalContext = true, isExpect = false) { - for (declaration in ktEnumEntry.declarations) { - declarations += declaration.toFirDeclaration( - correctedEnumSelfTypeRef, - delegatedSelfType = delegatedEntrySelfType, - ktEnumEntry, - ownerClassBuilder = this, - ownerTypeParameters = emptyList() - ) + superTypeRefs += delegatedEnumSelfTypeRef + val superTypeCallEntry = superTypeListEntries.firstIsInstanceOrNull() + val correctedEnumSelfTypeRef = buildResolvedTypeRef { + source = superTypeCallEntry?.calleeExpression?.typeReference?.toFirSourceElement() + type = delegatedEnumSelfTypeRef.type + } + declarations += primaryConstructor.toFirConstructor( + superTypeCallEntry, + correctedEnumSelfTypeRef, + delegatedEntrySelfType, + owner = ktEnumEntry, + typeParameters, + allSuperTypeCallEntries = emptyList(), + containingClassIsExpectClass, + copyConstructedTypeRefWithImplicitSource = true, + ) + // Use ANONYMOUS_OBJECT_NAME for the owner class id for enum entry declarations (see KT-42351) + withChildClassName(SpecialNames.ANONYMOUS, forceLocalContext = true, isExpect = false) { + for (declaration in ktEnumEntry.declarations) { + declarations += declaration.toFirDeclaration( + correctedEnumSelfTypeRef, + delegatedSelfType = delegatedEntrySelfType, + ktEnumEntry, + ownerClassBuilder = this, + ownerTypeParameters = emptyList() + ) + } } } } } } + }.apply { + containingClassForStaticMemberAttr = currentDispatchReceiverType()!!.lookupTag } - }.apply { - containingClassForStaticMemberAttr = currentDispatchReceiverType()!!.lookupTag } } @@ -1415,143 +1458,152 @@ open class PsiRawFirBuilder( isExpect = classIsExpect, forceLocalContext = isLocalWithinParent, ) { - val isLocal = context.inLocalContext - val classKind = when (classOrObject) { - is KtObjectDeclaration -> ClassKind.OBJECT - is KtClass -> when { - classOrObject.isInterface() -> ClassKind.INTERFACE - classOrObject.isEnum() -> ClassKind.ENUM_CLASS - classOrObject.isAnnotation() -> ClassKind.ANNOTATION_CLASS - else -> ClassKind.CLASS + val classSymbol = FirRegularClassSymbol(context.currentClassId) + withContainerSymbol(classSymbol) { + val isLocal = context.inLocalContext + val classKind = when (classOrObject) { + is KtObjectDeclaration -> ClassKind.OBJECT + is KtClass -> when { + classOrObject.isInterface() -> ClassKind.INTERFACE + classOrObject.isEnum() -> ClassKind.ENUM_CLASS + classOrObject.isAnnotation() -> ClassKind.ANNOTATION_CLASS + else -> ClassKind.CLASS + } + else -> throw AssertionError("Unexpected class or object: ${classOrObject.text}") + } + val status = FirDeclarationStatusImpl( + if (isLocal) Visibilities.Local else classOrObject.visibility, + classOrObject.modality, + ).apply { + isExpect = classIsExpect + isActual = classOrObject.hasActualModifier() + isInner = classOrObject.hasModifier(INNER_KEYWORD) && classOrObject.parent.parent !is KtScript + isCompanion = (classOrObject as? KtObjectDeclaration)?.isCompanion() == true + isData = classOrObject.hasModifier(DATA_KEYWORD) + isInline = classOrObject.hasModifier(INLINE_KEYWORD) || classOrObject.hasModifier(VALUE_KEYWORD) + isFun = classOrObject.hasModifier(FUN_KEYWORD) + isExternal = classOrObject.hasModifier(EXTERNAL_KEYWORD) } - else -> throw AssertionError("Unexpected class or object: ${classOrObject.text}") - } - val status = FirDeclarationStatusImpl( - if (isLocal) Visibilities.Local else classOrObject.visibility, - classOrObject.modality, - ).apply { - isExpect = classIsExpect - isActual = classOrObject.hasActualModifier() - isInner = classOrObject.hasModifier(INNER_KEYWORD) && classOrObject.parent.parent !is KtScript - isCompanion = (classOrObject as? KtObjectDeclaration)?.isCompanion() == true - isData = classOrObject.hasModifier(DATA_KEYWORD) - isInline = classOrObject.hasModifier(INLINE_KEYWORD) || classOrObject.hasModifier(VALUE_KEYWORD) - isFun = classOrObject.hasModifier(FUN_KEYWORD) - isExternal = classOrObject.hasModifier(EXTERNAL_KEYWORD) - } - withCapturedTypeParameters(status.isInner || isLocal, sourceElement, listOf()) { - var delegatedFieldsMap: Map? - buildRegularClass { - source = sourceElement - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - name = classOrObject.nameAsSafeName - this.status = status - this.classKind = classKind - scopeProvider = baseScopeProvider - symbol = FirRegularClassSymbol(context.currentClassId) + withCapturedTypeParameters(status.isInner || isLocal, sourceElement, listOf()) { + var delegatedFieldsMap: Map? + buildRegularClass { + source = sourceElement + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + name = classOrObject.nameAsSafeName + this.status = status + this.classKind = classKind + scopeProvider = baseScopeProvider + symbol = classSymbol - classOrObject.extractAnnotationsTo(this) - classOrObject.extractTypeParametersTo(this, symbol) + classOrObject.extractAnnotationsTo(this) + classOrObject.extractTypeParametersTo(this, symbol) - context.appendOuterTypeParameters(ignoreLastLevel = true, typeParameters) - context.pushFirTypeParameters( - status.isInner || isLocal, - typeParameters.subList(0, classOrObject.typeParameters.size) - ) + context.appendOuterTypeParameters(ignoreLastLevel = true, typeParameters) + context.pushFirTypeParameters( + status.isInner || isLocal, + typeParameters.subList(0, classOrObject.typeParameters.size) + ) - val delegatedSelfType = classOrObject.toDelegatedSelfType(this) - registerSelfType(delegatedSelfType) + val delegatedSelfType = classOrObject.toDelegatedSelfType(this) + registerSelfType(delegatedSelfType) - val (delegatedSuperType, extractedDelegatedFieldsMap) = classOrObject.extractSuperTypeListEntriesTo( - this, - delegatedSelfType, - null, - classKind, - typeParameters, - containingClassIsExpectClass = classIsExpect - ) - delegatedFieldsMap = extractedDelegatedFieldsMap + val (delegatedSuperType, extractedDelegatedFieldsMap) = classOrObject.extractSuperTypeListEntriesTo( + this, + delegatedSelfType, + null, + classKind, + typeParameters, + containingClassIsExpectClass = classIsExpect + ) + delegatedFieldsMap = extractedDelegatedFieldsMap - val primaryConstructor = classOrObject.primaryConstructor - val firPrimaryConstructor = declarations.firstOrNull { it is FirConstructor } as? FirConstructor - if (primaryConstructor != null && firPrimaryConstructor != null) { - primaryConstructor.valueParameters.zip( - firPrimaryConstructor.valueParameters - ).forEach { (ktParameter, firParameter) -> - if (ktParameter.hasValOrVar()) { - addDeclaration(ktParameter.toFirProperty(firParameter)) + val primaryConstructor = classOrObject.primaryConstructor + val firPrimaryConstructor = declarations.firstOrNull { it is FirConstructor } as? FirConstructor + if (primaryConstructor != null && firPrimaryConstructor != null) { + primaryConstructor.valueParameters.zip( + firPrimaryConstructor.valueParameters + ).forEach { (ktParameter, firParameter) -> + if (ktParameter.hasValOrVar()) { + addDeclaration(ktParameter.toFirProperty(firParameter)) + } } } - } - for (declaration in classOrObject.declarations) { - addDeclaration( - declaration.toFirDeclaration( - delegatedSuperType, - delegatedSelfType, + for (declaration in classOrObject.declarations) { + addDeclaration( + declaration.toFirDeclaration( + delegatedSuperType, + delegatedSelfType, + classOrObject, + this, + typeParameters + ) + ) + } + for (danglingModifier in classOrObject.body?.danglingModifierLists ?: emptyList()) { + addDeclaration( + buildErrorTopLevelDeclarationForDanglingModifierList(danglingModifier).apply { + containingClassAttr = currentDispatchReceiverType()?.lookupTag + } + ) + } + + if (classOrObject.hasModifier(DATA_KEYWORD) && firPrimaryConstructor != null) { + val zippedParameters = + classOrObject.primaryConstructorParameters.filter { it.hasValOrVar() } zip declarations.filterIsInstance() + DataClassMembersGenerator( classOrObject, this, - typeParameters + zippedParameters, + context.packageFqName, + context.className, + createClassTypeRefWithSourceKind = { firPrimaryConstructor.returnTypeRef.copyWithNewSourceKind(it) }, + createParameterTypeRefWithSourceKind = { property, newKind -> + property.returnTypeRef.copyWithNewSourceKind(newKind) + }, + addValueParameterAnnotations = { + addAnnotationsFrom( + it as KtParameter, + isFromPrimaryConstructor = true, + ) + }, + ).generate() + } + + if (classOrObject.hasModifier(ENUM_KEYWORD)) { + generateValuesFunction( + baseModuleData, + context.packageFqName, + context.className, + classIsExpect ) - ) - } - for (danglingModifier in classOrObject.body?.danglingModifierLists ?: emptyList()) { - addDeclaration( - buildErrorTopLevelDeclarationForDanglingModifierList(danglingModifier).apply { - containingClassAttr = currentDispatchReceiverType()?.lookupTag - } - ) - } + generateValueOfFunction( + baseModuleData, context.packageFqName, context.className, + classIsExpect + ) + generateEntriesGetter( + baseModuleData, context.packageFqName, context.className, + classIsExpect + ) + } - if (classOrObject.hasModifier(DATA_KEYWORD) && firPrimaryConstructor != null) { - val zippedParameters = - classOrObject.primaryConstructorParameters.filter { it.hasValOrVar() } zip declarations.filterIsInstance() - DataClassMembersGenerator( - classOrObject, - this, - zippedParameters, - context.packageFqName, - context.className, - createClassTypeRefWithSourceKind = { firPrimaryConstructor.returnTypeRef.copyWithNewSourceKind(it) }, - createParameterTypeRefWithSourceKind = { property, newKind -> - property.returnTypeRef.copyWithNewSourceKind(newKind) - }, - addValueParameterAnnotations = { addAnnotationsFrom(it as KtParameter, isFromPrimaryConstructor = true) }, - ).generate() + initCompanionObjectSymbolAttr() + + context.popFirTypeParameters() + contextReceivers.addAll(convertContextReceivers(classOrObject.contextReceivers)) + }.also { + it.delegateFieldsMap = delegatedFieldsMap } - - if (classOrObject.hasModifier(ENUM_KEYWORD)) { - generateValuesFunction( - baseModuleData, - context.packageFqName, - context.className, - classIsExpect - ) - generateValueOfFunction( - baseModuleData, context.packageFqName, context.className, - classIsExpect - ) - generateEntriesGetter( - baseModuleData, context.packageFqName, context.className, - classIsExpect - ) - } - - initCompanionObjectSymbolAttr() - - context.popFirTypeParameters() - contextReceivers.addAll(convertContextReceivers(classOrObject.contextReceivers)) }.also { - it.delegateFieldsMap = delegatedFieldsMap + classOrObject.fillDanglingConstraintsTo(it) } } }.also { if (classOrObject.parent is KtClassBody) { it.initContainingClassForLocalAttr() } - classOrObject.fillDanglingConstraintsTo(it) } } @@ -1609,129 +1661,140 @@ open class PsiRawFirBuilder( val typeAliasIsExpect = typeAlias.hasExpectModifier() || context.containerIsExpect return withChildClassName(typeAlias.nameAsSafeName, isExpect = typeAliasIsExpect) { buildTypeAlias { - source = typeAlias.toFirSourceElement() - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - name = typeAlias.nameAsSafeName - val isLocal = context.inLocalContext - status = FirDeclarationStatusImpl(if (isLocal) Visibilities.Local else typeAlias.visibility, Modality.FINAL).apply { - isExpect = typeAliasIsExpect - isActual = typeAlias.hasActualModifier() - } symbol = FirTypeAliasSymbol(context.currentClassId) - expandedTypeRef = typeAlias.getTypeReference().toFirOrErrorType() - typeAlias.extractAnnotationsTo(this) - typeAlias.extractTypeParametersTo(this, symbol) + withContainerSymbol(symbol) { + source = typeAlias.toFirSourceElement() + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + name = typeAlias.nameAsSafeName + val isLocal = context.inLocalContext + status = FirDeclarationStatusImpl(if (isLocal) Visibilities.Local else typeAlias.visibility, Modality.FINAL).apply { + isExpect = typeAliasIsExpect + isActual = typeAlias.hasActualModifier() + } + expandedTypeRef = typeAlias.getTypeReference().toFirOrErrorType() + typeAlias.extractAnnotationsTo(this) + typeAlias.extractTypeParametersTo(this, symbol) + } } } } override fun visitNamedFunction(function: KtNamedFunction, data: FirElement?): FirElement { - val typeReference = function.typeReference - val returnType = if (function.hasBlockBody()) { - typeReference.toFirOrUnitType() - } else { - typeReference.toFirOrImplicitType() - } - - val receiverType = function.receiverTypeReference?.toFirType() - val labelName: String? val isAnonymousFunction = function.isAnonymous val isLocalFunction = function.isLocal - val functionSymbol: FirFunctionSymbol<*> - val functionBuilder = if (isAnonymousFunction) { - FirAnonymousFunctionBuilder().apply { - receiverParameter = receiverType?.convertToReceiverParameter() - symbol = FirAnonymousFunctionSymbol().also { functionSymbol = it } - isLambda = false - hasExplicitParameterList = true - label = context.getLastLabel(function) - labelName = label?.name ?: context.calleeNamesForLambda.lastOrNull()?.identifier - if (function.hasModifier(SUSPEND_KEYWORD)) { - status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION - } - } + val functionSymbol: FirFunctionSymbol<*> = if (isAnonymousFunction) { + FirAnonymousFunctionSymbol() } else { - FirSimpleFunctionBuilder().apply { - receiverParameter = receiverType?.convertToReceiverParameter() - name = function.nameAsSafeName - labelName = context.getLastLabel(function)?.name ?: runIf(!name.isSpecial) { name.identifier } - symbol = FirNamedFunctionSymbol(callableIdForName(function.nameAsSafeName)).also { functionSymbol = it } - dispatchReceiverType = runIf(!isLocalFunction) { currentDispatchReceiverType() } - status = FirDeclarationStatusImpl( - if (isLocalFunction) Visibilities.Local else function.visibility, - function.modality, - ).apply { - isExpect = function.hasExpectModifier() || context.containerIsExpect - isActual = function.hasActualModifier() - isOverride = function.hasModifier(OVERRIDE_KEYWORD) - isOperator = function.hasModifier(OPERATOR_KEYWORD) - isInfix = function.hasModifier(INFIX_KEYWORD) - isInline = function.hasModifier(INLINE_KEYWORD) - isTailRec = function.hasModifier(TAILREC_KEYWORD) - isExternal = function.hasModifier(EXTERNAL_KEYWORD) - isSuspend = function.hasModifier(SUSPEND_KEYWORD) - } - - contextReceivers.addAll(convertContextReceivers(function.contextReceivers)) - } + FirNamedFunctionSymbol(callableIdForName(function.nameAsSafeName)) } - val target = FirFunctionTarget(labelName, isLambda = false) - val functionSource = function.toFirSourceElement() - val firFunction = functionBuilder.apply { - source = functionSource - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - returnTypeRef = returnType + withContainerSymbol(functionSymbol, isLocalFunction) { + val typeReference = function.typeReference + val returnType = if (function.hasBlockBody()) { + typeReference.toFirOrUnitType() + } else { + typeReference.toFirOrImplicitType() + } - context.firFunctionTargets += target - function.extractAnnotationsTo(this) - if (this is FirSimpleFunctionBuilder) { - function.extractTypeParametersTo(this, symbol) - } - for (valueParameter in function.valueParameters) { - valueParameters += convertValueParameter( - valueParameter, - functionSymbol, - null, - if (isAnonymousFunction) ValueParameterDeclaration.LAMBDA else ValueParameterDeclaration.FUNCTION - ) - } - val actualTypeParameters = if (this is FirSimpleFunctionBuilder) - this.typeParameters - else - listOf() - withCapturedTypeParameters(true, functionSource, actualTypeParameters) { - val outerContractDescription = function.obtainContractDescription() - val (body, innerContractDescription) = withForcedLocalContext { - function.buildFirBody() - } - this.body = body - val contractDescription = outerContractDescription ?: innerContractDescription - contractDescription?.let { - if (this is FirSimpleFunctionBuilder) { - this.contractDescription = it - } else if (this is FirAnonymousFunctionBuilder) { - this.contractDescription = it + val receiverType = function.receiverTypeReference?.toFirType() + val labelName: String? + + val functionBuilder = if (isAnonymousFunction) { + FirAnonymousFunctionBuilder().apply { + receiverParameter = receiverType?.convertToReceiverParameter() + symbol = functionSymbol as FirAnonymousFunctionSymbol + isLambda = false + hasExplicitParameterList = true + label = context.getLastLabel(function) + labelName = label?.name ?: context.calleeNamesForLambda.lastOrNull()?.identifier + if (function.hasModifier(SUSPEND_KEYWORD)) { + status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION } } + } else { + FirSimpleFunctionBuilder().apply { + receiverParameter = receiverType?.convertToReceiverParameter() + name = function.nameAsSafeName + labelName = context.getLastLabel(function)?.name ?: runIf(!name.isSpecial) { name.identifier } + symbol = functionSymbol as FirNamedFunctionSymbol + dispatchReceiverType = runIf(!isLocalFunction) { currentDispatchReceiverType() } + status = FirDeclarationStatusImpl( + if (isLocalFunction) Visibilities.Local else function.visibility, + function.modality, + ).apply { + isExpect = function.hasExpectModifier() || context.containerIsExpect + isActual = function.hasActualModifier() + isOverride = function.hasModifier(OVERRIDE_KEYWORD) + isOperator = function.hasModifier(OPERATOR_KEYWORD) + isInfix = function.hasModifier(INFIX_KEYWORD) + isInline = function.hasModifier(INLINE_KEYWORD) + isTailRec = function.hasModifier(TAILREC_KEYWORD) + isExternal = function.hasModifier(EXTERNAL_KEYWORD) + isSuspend = function.hasModifier(SUSPEND_KEYWORD) + } + + contextReceivers.addAll(convertContextReceivers(function.contextReceivers)) + } } - context.firFunctionTargets.removeLast() - additionalFunctionInit() - }.build().also { - bindFunctionTarget(target, it) - if (it is FirSimpleFunction) { - function.fillDanglingConstraintsTo(it) - } - } - return if (firFunction is FirAnonymousFunction) { - buildAnonymousFunctionExpression { + + val target = FirFunctionTarget(labelName, isLambda = false) + val functionSource = function.toFirSourceElement() + val firFunction = functionBuilder.apply { source = functionSource - anonymousFunction = firFunction + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + returnTypeRef = returnType + + context.firFunctionTargets += target + function.extractAnnotationsTo(this) + if (this is FirSimpleFunctionBuilder) { + function.extractTypeParametersTo(this, symbol) + } + for (valueParameter in function.valueParameters) { + valueParameters += convertValueParameter( + valueParameter, + functionSymbol, + null, + if (isAnonymousFunction) ValueParameterDeclaration.LAMBDA else ValueParameterDeclaration.FUNCTION + ) + } + val actualTypeParameters = if (this is FirSimpleFunctionBuilder) + this.typeParameters + else + listOf() + withCapturedTypeParameters(true, functionSource, actualTypeParameters) { + val outerContractDescription = function.obtainContractDescription() + val (body, innerContractDescription) = withForcedLocalContext { + function.buildFirBody() + } + this.body = body + val contractDescription = outerContractDescription ?: innerContractDescription + contractDescription?.let { + if (this is FirSimpleFunctionBuilder) { + this.contractDescription = it + } else if (this is FirAnonymousFunctionBuilder) { + this.contractDescription = it + } + } + } + context.firFunctionTargets.removeLast() + additionalFunctionInit() + }.build().also { + bindFunctionTarget(target, it) + if (it is FirSimpleFunction) { + function.fillDanglingConstraintsTo(it) + } + } + + return if (firFunction is FirAnonymousFunction) { + buildAnonymousFunctionExpression { + source = functionSource + anonymousFunction = firFunction + } + } else { + firFunction } - } else { - firFunction } } @@ -1868,38 +1931,40 @@ open class PsiRawFirBuilder( ): FirConstructor { val target = FirFunctionTarget(labelName = null, isLambda = false) return buildConstructor { - source = this@toFirConstructor.toFirSourceElement() - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - returnTypeRef = selfTypeRef - val explicitVisibility = visibility - status = FirDeclarationStatusImpl(explicitVisibility, Modality.FINAL).apply { - isExpect = hasExpectModifier() || this@PsiRawFirBuilder.context.containerIsExpect - isActual = hasActualModifier() - isInner = owner.hasModifier(INNER_KEYWORD) - isFromSealedClass = owner.hasModifier(SEALED_KEYWORD) && explicitVisibility !== Visibilities.Private - isFromEnumClass = owner.hasModifier(ENUM_KEYWORD) - } - dispatchReceiverType = owner.obtainDispatchReceiverForConstructor() - contextReceivers.addAll(convertContextReceivers(owner.contextReceivers)) symbol = FirConstructorSymbol(callableIdForClassConstructor()) - delegatedConstructor = buildOrLazyDelegatedConstructorCall( - isThis = isDelegatedCallToThis(), - constructedTypeRef = delegatedTypeRef, - ) { - getDelegationCall().convert(delegatedTypeRef) - } - this@PsiRawFirBuilder.context.firFunctionTargets += target - extractAnnotationsTo(this) - typeParameters += constructorTypeParametersFromConstructedClass(ownerTypeParameters) - extractValueParametersTo(this, symbol, ValueParameterDeclaration.FUNCTION) + withContainerSymbol(symbol) { + source = this@toFirConstructor.toFirSourceElement() + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + returnTypeRef = selfTypeRef + val explicitVisibility = visibility + status = FirDeclarationStatusImpl(explicitVisibility, Modality.FINAL).apply { + isExpect = hasExpectModifier() || this@PsiRawFirBuilder.context.containerIsExpect + isActual = hasActualModifier() + isInner = owner.hasModifier(INNER_KEYWORD) + isFromSealedClass = owner.hasModifier(SEALED_KEYWORD) && explicitVisibility !== Visibilities.Private + isFromEnumClass = owner.hasModifier(ENUM_KEYWORD) + } + dispatchReceiverType = owner.obtainDispatchReceiverForConstructor() + contextReceivers.addAll(convertContextReceivers(owner.contextReceivers)) + delegatedConstructor = buildOrLazyDelegatedConstructorCall( + isThis = isDelegatedCallToThis(), + constructedTypeRef = delegatedTypeRef, + ) { + getDelegationCall().convert(delegatedTypeRef) + } + this@PsiRawFirBuilder.context.firFunctionTargets += target + extractAnnotationsTo(this) + typeParameters += constructorTypeParametersFromConstructedClass(ownerTypeParameters) + extractValueParametersTo(this, symbol, ValueParameterDeclaration.FUNCTION) - val (body, contractDescription) = withForcedLocalContext { - buildFirBody() + val (body, contractDescription) = withForcedLocalContext { + buildFirBody() + } + contractDescription?.let { this.contractDescription = it } + this.body = body + this@PsiRawFirBuilder.context.firFunctionTargets.removeLast() } - contractDescription?.let { this.contractDescription = it } - this.body = body - this@PsiRawFirBuilder.context.firFunctionTargets.removeLast() }.also { it.containingClassForStaticMemberAttr = currentDispatchReceiverType()!!.lookupTag bindFunctionTarget(target, it) @@ -1953,167 +2018,177 @@ open class PsiRawFirBuilder( ownerRegularOrAnonymousObjectSymbol: FirClassSymbol<*>?, context: Context, ): FirProperty { - val propertyType = typeReference.toFirOrImplicitType() val propertyName = nameAsSafeName - val isVar = isVar - val propertyInitializer = toInitializerExpression() + val propertySymbol = if (isLocal) { + FirPropertySymbol(propertyName) + } else { + FirPropertySymbol(callableIdForName(propertyName)) + } - val propertySource = toFirSourceElement() + withContainerSymbol(propertySymbol, isLocal) { + val propertyType = typeReference.toFirOrImplicitType() + val isVar = isVar + val propertyInitializer = toInitializerExpression() - return buildProperty { - source = propertySource - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - returnTypeRef = propertyType - name = propertyName - this.isVar = isVar + val propertySource = toFirSourceElement() - receiverParameter = receiverTypeReference?.toFirType()?.convertToReceiverParameter() - initializer = propertyInitializer + return buildProperty { + source = propertySource + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + returnTypeRef = propertyType + name = propertyName + this.isVar = isVar - val propertyAnnotations = mutableListOf() - for (annotationEntry in annotationEntries) { - propertyAnnotations += annotationEntry.convert() - } - if (this@toFirProperty.isLocal) { - isLocal = true - symbol = FirPropertySymbol(propertyName) + receiverParameter = receiverTypeReference?.toFirType()?.convertToReceiverParameter() + initializer = propertyInitializer - extractTypeParametersTo(this, symbol) - backingField = this@toFirProperty.fieldDeclaration.toFirBackingField( - this@toFirProperty, - propertySymbol = symbol, - propertyType, - emptyList(), - ) - - status = FirDeclarationStatusImpl(Visibilities.Local, Modality.FINAL).apply { - isLateInit = hasModifier(LATEINIT_KEYWORD) + val propertyAnnotations = mutableListOf() + for (annotationEntry in annotationEntries) { + propertyAnnotations += annotationEntry.convert() } + if (this@toFirProperty.isLocal) { + isLocal = true + symbol = propertySymbol - if (hasDelegate()) { - fun extractDelegateExpression() = - this@toFirProperty.delegate?.expression.toFirExpression("Incorrect delegate expression") - - val delegateBuilder = FirWrappedDelegateExpressionBuilder().apply { - val delegateFirExpression = extractDelegateExpression() - source = delegateFirExpression.source?.fakeElement(KtFakeSourceElementKind.WrappedDelegate) - ?: this@toFirProperty.delegate?.toFirSourceElement(KtFakeSourceElementKind.WrappedDelegate) - expression = delegateFirExpression - } - - generateAccessorsByDelegate( - delegateBuilder, - baseModuleData, - ownerRegularOrAnonymousObjectSymbol = null, - context = context, - isExtension = false, - ) - } - } else { - isLocal = false - symbol = FirPropertySymbol(callableIdForName(propertyName)) - dispatchReceiverType = currentDispatchReceiverType() - extractTypeParametersTo(this, symbol) - withCapturedTypeParameters(true, propertySource, this.typeParameters) { + extractTypeParametersTo(this, symbol) backingField = this@toFirProperty.fieldDeclaration.toFirBackingField( this@toFirProperty, propertySymbol = symbol, propertyType, - propertyAnnotations.filter { it.useSiteTarget == FIELD || it.useSiteTarget == PROPERTY_DELEGATE_FIELD }, + emptyList(), ) - getter = convertPropertyAccessor( - this@toFirProperty.getter, - this@toFirProperty, - propertyType, - propertySymbol = symbol, - isGetter = true, - accessorAnnotationsFromProperty = propertyAnnotations.filterUseSiteTarget(PROPERTY_GETTER), - parameterAnnotationsFromProperty = emptyList() - ) - - setter = convertPropertyAccessor( - this@toFirProperty.setter, - this@toFirProperty, - propertyType, - propertySymbol = symbol, - isGetter = false, - accessorAnnotationsFromProperty = propertyAnnotations.filterUseSiteTarget(PROPERTY_SETTER), - parameterAnnotationsFromProperty = propertyAnnotations.filterUseSiteTarget(SETTER_PARAMETER) - ) - - status = FirDeclarationStatusImpl(visibility, modality).apply { - isExpect = hasExpectModifier() || this@PsiRawFirBuilder.context.containerIsExpect - isActual = hasActualModifier() - isOverride = hasModifier(OVERRIDE_KEYWORD) - isConst = hasModifier(CONST_KEYWORD) + status = FirDeclarationStatusImpl(Visibilities.Local, Modality.FINAL).apply { isLateInit = hasModifier(LATEINIT_KEYWORD) - isExternal = hasModifier(EXTERNAL_KEYWORD) } - val psiPropertyDelegate = this@toFirProperty.delegate - if (psiPropertyDelegate != null) { - fun extractDelegateExpression(): FirExpression { - return buildOrLazyExpression(psiPropertyDelegate.expression?.toFirSourceElement(KtFakeSourceElementKind.WrappedDelegate)) { - psiPropertyDelegate.expression?.toFirExpression("Should have delegate") ?: buildErrorExpression { - diagnostic = ConeSimpleDiagnostic("Should have delegate", DiagnosticKind.ExpressionExpected) - } - } - } + if (hasDelegate()) { + fun extractDelegateExpression() = + this@toFirProperty.delegate?.expression.toFirExpression("Incorrect delegate expression") val delegateBuilder = FirWrappedDelegateExpressionBuilder().apply { - val delegateExpression = extractDelegateExpression() - source = (psiPropertyDelegate.expression ?: psiPropertyDelegate) - .toFirSourceElement(KtFakeSourceElementKind.WrappedDelegate) - - expression = delegateExpression + val delegateFirExpression = extractDelegateExpression() + source = delegateFirExpression.source?.fakeElement(KtFakeSourceElementKind.WrappedDelegate) + ?: this@toFirProperty.delegate?.toFirSourceElement(KtFakeSourceElementKind.WrappedDelegate) + expression = delegateFirExpression } - val (lazyDelegateExpression: FirLazyExpression?, lazyBody: FirLazyBlock?) = buildOrLazy( - build = { null to null }, - lazy = { buildLazyExpression { source = delegateBuilder.source } to buildLazyBlock() }, - ) - generateAccessorsByDelegate( delegateBuilder, baseModuleData, - ownerRegularOrAnonymousObjectSymbol, - context, - isExtension = receiverTypeReference != null, - lazyDelegateExpression = lazyDelegateExpression, - lazyBodyForGeneratedAccessors = lazyBody, - ::bindFunctionTarget, + ownerRegularOrAnonymousObjectSymbol = null, + context = context, + isExtension = false, ) } - } - } - annotations += if (isLocal) propertyAnnotations else propertyAnnotations.filter { - it.useSiteTarget != FIELD && it.useSiteTarget != PROPERTY_DELEGATE_FIELD && it.useSiteTarget != PROPERTY_GETTER && - (!isVar || it.useSiteTarget != SETTER_PARAMETER && it.useSiteTarget != PROPERTY_SETTER) - } + } else { + isLocal = false + symbol = propertySymbol + dispatchReceiverType = currentDispatchReceiverType() + extractTypeParametersTo(this, symbol) + withCapturedTypeParameters(true, propertySource, this.typeParameters) { + backingField = this@toFirProperty.fieldDeclaration.toFirBackingField( + this@toFirProperty, + propertySymbol = symbol, + propertyType, + propertyAnnotations.filter { it.useSiteTarget == FIELD || it.useSiteTarget == PROPERTY_DELEGATE_FIELD }, + ) - contextReceivers.addAll(convertContextReceivers(this@toFirProperty.contextReceivers)) - additionalPropertyInit() - }.also { - if (!isLocal) { - fillDanglingConstraintsTo(it) + getter = convertPropertyAccessor( + this@toFirProperty.getter, + this@toFirProperty, + propertyType, + propertySymbol = symbol, + isGetter = true, + accessorAnnotationsFromProperty = propertyAnnotations.filterUseSiteTarget(PROPERTY_GETTER), + parameterAnnotationsFromProperty = emptyList() + ) + + setter = convertPropertyAccessor( + this@toFirProperty.setter, + this@toFirProperty, + propertyType, + propertySymbol = symbol, + isGetter = false, + accessorAnnotationsFromProperty = propertyAnnotations.filterUseSiteTarget(PROPERTY_SETTER), + parameterAnnotationsFromProperty = propertyAnnotations.filterUseSiteTarget(SETTER_PARAMETER) + ) + + status = FirDeclarationStatusImpl(visibility, modality).apply { + isExpect = hasExpectModifier() || this@PsiRawFirBuilder.context.containerIsExpect + isActual = hasActualModifier() + isOverride = hasModifier(OVERRIDE_KEYWORD) + isConst = hasModifier(CONST_KEYWORD) + isLateInit = hasModifier(LATEINIT_KEYWORD) + isExternal = hasModifier(EXTERNAL_KEYWORD) + } + + val psiPropertyDelegate = this@toFirProperty.delegate + if (psiPropertyDelegate != null) { + fun extractDelegateExpression(): FirExpression { + return buildOrLazyExpression(psiPropertyDelegate.expression?.toFirSourceElement(KtFakeSourceElementKind.WrappedDelegate)) { + psiPropertyDelegate.expression?.toFirExpression("Should have delegate") ?: buildErrorExpression { + diagnostic = ConeSimpleDiagnostic("Should have delegate", DiagnosticKind.ExpressionExpected) + } + } + } + + val delegateBuilder = FirWrappedDelegateExpressionBuilder().apply { + val delegateExpression = extractDelegateExpression() + source = (psiPropertyDelegate.expression ?: psiPropertyDelegate) + .toFirSourceElement(KtFakeSourceElementKind.WrappedDelegate) + + expression = delegateExpression + } + + val (lazyDelegateExpression: FirLazyExpression?, lazyBody: FirLazyBlock?) = buildOrLazy( + build = { null to null }, + lazy = { buildLazyExpression { source = delegateBuilder.source } to buildLazyBlock() }, + ) + + generateAccessorsByDelegate( + delegateBuilder, + baseModuleData, + ownerRegularOrAnonymousObjectSymbol, + context, + isExtension = receiverTypeReference != null, + lazyDelegateExpression = lazyDelegateExpression, + lazyBodyForGeneratedAccessors = lazyBody, + ::bindFunctionTarget, + ) + } + } + } + annotations += if (isLocal) propertyAnnotations else propertyAnnotations.filter { + it.useSiteTarget != FIELD && it.useSiteTarget != PROPERTY_DELEGATE_FIELD && it.useSiteTarget != PROPERTY_GETTER && + (!isVar || it.useSiteTarget != SETTER_PARAMETER && it.useSiteTarget != PROPERTY_SETTER) + } + + contextReceivers.addAll(convertContextReceivers(this@toFirProperty.contextReceivers)) + additionalPropertyInit() + }.also { + if (!isLocal) { + fillDanglingConstraintsTo(it) + } } } } override fun visitAnonymousInitializer(initializer: KtAnonymousInitializer, data: FirElement?): FirElement { return buildAnonymousInitializer { - source = initializer.toFirSourceElement() - moduleData = baseModuleData - origin = FirDeclarationOrigin.Source - body = buildOrLazyBlock { - withForcedLocalContext { - initializer.body.toFirBlock() + withContainerSymbol(symbol) { + source = initializer.toFirSourceElement() + moduleData = baseModuleData + origin = FirDeclarationOrigin.Source + body = buildOrLazyBlock { + withForcedLocalContext { + initializer.body.toFirBlock() + } } + dispatchReceiverType = context.dispatchReceiverTypesStack.lastOrNull() + initializer.extractAnnotationsTo(this) } - dispatchReceiverType = context.dispatchReceiverTypesStack.lastOrNull() - initializer.extractAnnotationsTo(this) } } @@ -2282,6 +2357,7 @@ open class PsiRawFirBuilder( this.name = name } typeArguments.appendTypeArguments(annotationEntry.typeArguments) + containingDeclarationSymbol = context.containerSymbol } } @@ -3088,8 +3164,10 @@ open class PsiRawFirBuilder( origin = FirDeclarationOrigin.Source diagnostic = ConeDanglingModifierOnTopLevel symbol = FirDanglingModifierSymbol() - for (annotationEntry in modifierList.getAnnotationEntries()) { - annotations += annotationEntry.convert() + withContainerSymbol(symbol) { + for (annotationEntry in modifierList.getAnnotationEntries()) { + annotations += annotationEntry.convert() + } } } } diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.annotationOwners.txt new file mode 100644 index 00000000000..723187f4cb9 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.annotationOwners.txt @@ -0,0 +1,182 @@ +@Target(AnnotationTarget#.CLASS#, AnnotationTarget#.PROPERTY#, AnnotationTarget#.LOCAL_VARIABLE#, AnnotationTarget#.VALUE_PARAMETER#, AnnotationTarget#.CONSTRUCTOR#, AnnotationTarget#.FUNCTION#, AnnotationTarget#.TYPE#) +owner -> FirRegularClassSymbol base +context -> FirRegularClassSymbol base + +@base() +owner -> FirConstructorSymbol /correct.correct +context -> FirValueParameterSymbol /x from FirConstructorSymbol /correct.correct + +@base() +owner -> FirPropertySymbol /correct.x +context -> FirPropertySymbol /correct.x + +@base() +owner -> FirConstructorSymbol /correct.correct +context -> FirConstructorSymbol /correct.correct + +@base() +owner -> FirAnonymousInitializerSymbol +context -> FirAnonymousInitializerSymbol from FirRegularClassSymbol correct + +@base() +owner -> FirRegularClassSymbol correct +context -> FirRegularClassSymbol correct + +@base() +owner -> FirEnumEntrySymbol /My.FIRST +context -> FirEnumEntrySymbol /My.FIRST + +@base() +owner -> FirEnumEntrySymbol /My.SECOND +context -> FirEnumEntrySymbol /My.SECOND + +@base() +owner -> FirRegularClassSymbol My +context -> FirRegularClassSymbol My + +@base() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /foo + +@base() +owner -> FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /y from FirNamedFunctionSymbol /foo + +@base() +owner -> FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /y from FirNamedFunctionSymbol /foo + +@base() +owner -> FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /z from FirNamedFunctionSymbol /bar from FirNamedFunctionSymbol /foo + +@base() +owner -> FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /z from FirNamedFunctionSymbol /bar from FirNamedFunctionSymbol /foo + +@base() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /bar from FirNamedFunctionSymbol /foo + +@base() +owner -> FirNamedFunctionSymbol /foo +context -> FirPropertySymbol /local from FirNamedFunctionSymbol /foo + +@base() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /foo + +@base() +owner -> FirPropertySymbol /z +context -> FirPropertySymbol /z + +@base() +owner -> FirPropertySymbol /x +context -> FirPropertySymbol /x +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /x +context -> FirBackingFieldSymbol /field from FirPropertySymbol /x + +@base() +owner -> FirPropertySymbol /x +context -> FirPropertySymbol /x +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /x +context -> FirBackingFieldSymbol /field from FirPropertySymbol /x + +@base() +owner -> FirPropertySymbol /x +context -> FirPropertySymbol /x + +@Target(AnnotationTarget#.CLASS#, AnnotationTarget#.PROPERTY#, AnnotationTarget#.LOCAL_VARIABLE#, AnnotationTarget#.VALUE_PARAMETER#, AnnotationTarget#.CONSTRUCTOR#, AnnotationTarget#.FUNCTION#, AnnotationTarget#.TYPE#) +owner -> FirRegularClassSymbol derived +context -> FirRegularClassSymbol derived + +@base() +owner -> FirRegularClassSymbol derived +context -> FirRegularClassSymbol derived + +@derived(IntegerLiteral(1)) +owner -> FirConstructorSymbol /correctDerived.correctDerived +context -> FirValueParameterSymbol /x from FirConstructorSymbol /correctDerived.correctDerived +context -> FirPropertySymbol /correctDerived.x +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /correctDerived.x +context -> FirBackingFieldSymbol /field from FirPropertySymbol /correctDerived.x + +@derived(IntegerLiteral(1)) +owner -> FirConstructorSymbol /correctDerived.correctDerived +context -> FirValueParameterSymbol /x from FirConstructorSymbol /correctDerived.correctDerived + +@derived(IntegerLiteral(1)) +owner -> FirPropertySymbol /correctDerived.x +context -> FirPropertySymbol /correctDerived.x + +@base() +owner -> FirConstructorSymbol /correctDerived.correctDerived +context -> FirConstructorSymbol /correctDerived.correctDerived + +@derived(IntegerLiteral(1)) +owner -> FirRegularClassSymbol correctDerived +context -> FirRegularClassSymbol correctDerived + +@derived(IntegerLiteral(1)) +owner -> FirEnumEntrySymbol /MyDerived.FIRST +context -> FirEnumEntrySymbol /MyDerived.FIRST + +@derived(IntegerLiteral(1)) +owner -> FirEnumEntrySymbol /MyDerived.SECOND +context -> FirEnumEntrySymbol /MyDerived.SECOND + +@derived(IntegerLiteral(1)) +owner -> FirRegularClassSymbol MyDerived +context -> FirRegularClassSymbol MyDerived + +@derived(IntegerLiteral(1)) +owner -> FirNamedFunctionSymbol /fooDerived +context -> FirNamedFunctionSymbol /fooDerived + +@derived(IntegerLiteral(1)) +owner -> FirNamedFunctionSymbol /fooDerived +context -> FirValueParameterSymbol /y from FirNamedFunctionSymbol /fooDerived + +@derived(IntegerLiteral(1)) +owner -> FirNamedFunctionSymbol /fooDerived +context -> FirValueParameterSymbol /y from FirNamedFunctionSymbol /fooDerived + +@derived(IntegerLiteral(1)) +owner -> FirNamedFunctionSymbol /fooDerived +context -> FirValueParameterSymbol /z from FirNamedFunctionSymbol /bar from FirNamedFunctionSymbol /fooDerived + +@derived(IntegerLiteral(1)) +owner -> FirNamedFunctionSymbol /fooDerived +context -> FirValueParameterSymbol /z from FirNamedFunctionSymbol /bar from FirNamedFunctionSymbol /fooDerived + +@derived(IntegerLiteral(1)) +owner -> FirNamedFunctionSymbol /fooDerived +context -> FirNamedFunctionSymbol /bar from FirNamedFunctionSymbol /fooDerived + +@derived(IntegerLiteral(1)) +owner -> FirNamedFunctionSymbol /fooDerived +context -> FirPropertySymbol /local from FirNamedFunctionSymbol /fooDerived + +@derived(IntegerLiteral(1)) +owner -> FirNamedFunctionSymbol /fooDerived +context -> FirNamedFunctionSymbol /fooDerived + +@derived(IntegerLiteral(1)) +owner -> FirPropertySymbol /zDerived +context -> FirPropertySymbol /zDerived + +@derived(IntegerLiteral(1)) +owner -> FirPropertySymbol /xDerived +context -> FirPropertySymbol /xDerived +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /xDerived +context -> FirBackingFieldSymbol /field from FirPropertySymbol /xDerived + +@derived(IntegerLiteral(1)) +owner -> FirPropertySymbol /xDerived +context -> FirPropertySymbol /xDerived +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /xDerived +context -> FirBackingFieldSymbol /field from FirPropertySymbol /xDerived + +@derived(IntegerLiteral(1)) +owner -> FirPropertySymbol /xDerived +context -> FirPropertySymbol /xDerived diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnField.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnField.annotationOwners.txt new file mode 100644 index 00000000000..33b2dc400a8 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnField.annotationOwners.txt @@ -0,0 +1,39 @@ +@FIELD:Ann() +owner -> FirConstructorSymbol /SomeClass.SomeClass +context -> FirConstructorSymbol /SomeClass.SomeClass + +@FIELD:Ann() +owner -> FirPropertySymbol /SomeClass.simpleProperty +context -> FirBackingFieldSymbol /field from FirPropertySymbol /SomeClass.simpleProperty + +@FIELD:Ann() +owner -> FirPropertySymbol /SomeClass.simplePropertyWithAnnotationList +context -> FirBackingFieldSymbol /field from FirPropertySymbol /SomeClass.simplePropertyWithAnnotationList + +@FIELD:Ann() +owner -> FirPropertySymbol /SomeClass.delegatedProperty +context -> FirBackingFieldSymbol /field from FirPropertySymbol /SomeClass.delegatedProperty + +@FIELD:Ann() +owner -> FirPropertySymbol /SomeClass.propertyWithCustomGetter +context -> FirBackingFieldSymbol /field from FirPropertySymbol /SomeClass.propertyWithCustomGetter + +@FIELD:Ann() +owner -> FirNamedFunctionSymbol /SomeClass.anotherFun +context -> FirValueParameterSymbol /s from FirNamedFunctionSymbol /SomeClass.anotherFun + +@FIELD:Ann() +owner -> FirNamedFunctionSymbol /SomeClass.anotherFun +context -> FirPropertySymbol /localVariable from FirNamedFunctionSymbol /SomeClass.anotherFun + +@FIELD:Ann() +owner -> FirNamedFunctionSymbol /SomeClass.anotherFun +context -> FirNamedFunctionSymbol /SomeClass.anotherFun + +@FIELD:Ann() +owner -> FirRegularClassSymbol SomeClass +context -> FirRegularClassSymbol SomeClass + +@FIELD:Ann() +owner -> FirPropertySymbol /WithPrimaryConstructor.a +context -> FirBackingFieldSymbol /field from FirPropertySymbol /WithPrimaryConstructor.a diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnProperty.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnProperty.annotationOwners.txt new file mode 100644 index 00000000000..91bf1d3b4da --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnProperty.annotationOwners.txt @@ -0,0 +1,35 @@ +@FIELD:Ann() +owner -> FirPropertySymbol /x +context -> FirBackingFieldSymbol /field from FirPropertySymbol /x + +@PROPERTY:Ann() +owner -> FirPropertySymbol /y +context -> FirPropertySymbol /y + +@Ann() +owner -> FirPropertySymbol /z +context -> FirPropertySymbol /z + +@CONSTRUCTOR_PARAMETER:Ann() +owner -> FirConstructorSymbol /Some.Some +context -> FirValueParameterSymbol /z from FirConstructorSymbol /Some.Some + +@FIELD:Ann() +owner -> FirPropertySymbol /Some.x +context -> FirBackingFieldSymbol /field from FirPropertySymbol /Some.x + +@PROPERTY:Ann() +owner -> FirPropertySymbol /Some.y +context -> FirPropertySymbol /Some.y + +@FIELD:Ann() +owner -> FirPropertySymbol /Some.a +context -> FirBackingFieldSymbol /field from FirPropertySymbol /Some.a + +@PROPERTY:Ann() +owner -> FirPropertySymbol /Some.b +context -> FirPropertySymbol /Some.b + +@Ann() +owner -> FirPropertySymbol /Some.c +context -> FirPropertySymbol /Some.c diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnSuperType.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnSuperType.annotationOwners.txt new file mode 100644 index 00000000000..1c528546c4c --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnSuperType.annotationOwners.txt @@ -0,0 +1,27 @@ +@Target(AnnotationTarget#.TYPE#) +owner -> FirRegularClassSymbol util/Anno +context -> FirRegularClassSymbol util/Anno + +@Anno((String(MyClassWithoutConstructor nested nested super type ref ), prop#)) +owner -> FirRegularClassSymbol util/MyClassWithoutConstructor +context -> FirRegularClassSymbol util/MyClassWithoutConstructor + +@Anno((String(MyClassWithoutConstructor nested super type ref ), prop#)) +owner -> FirRegularClassSymbol util/MyClassWithoutConstructor +context -> FirRegularClassSymbol util/MyClassWithoutConstructor + +@Anno((String(MyClassWithoutConstructor super type ref ), prop#)) +owner -> FirRegularClassSymbol util/MyClassWithoutConstructor +context -> FirRegularClassSymbol util/MyClassWithoutConstructor + +@Anno((String(MyClassWithConstructor nested nested super type ref ), prop#)) +owner -> FirRegularClassSymbol util/MyClassWithConstructor +context -> FirRegularClassSymbol util/MyClassWithConstructor + +@Anno((String(MyClassWithConstructor nested super type ref ), prop#)) +owner -> FirRegularClassSymbol util/MyClassWithConstructor +context -> FirRegularClassSymbol util/MyClassWithConstructor + +@Anno((String(MyClassWithConstructor super type ref ), prop#)) +owner -> FirRegularClassSymbol util/MyClassWithConstructor +context -> FirRegularClassSymbol util/MyClassWithConstructor diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnSuperTypeCall.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnSuperTypeCall.annotationOwners.txt new file mode 100644 index 00000000000..dd44d412838 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnSuperTypeCall.annotationOwners.txt @@ -0,0 +1,39 @@ +@Target(AnnotationTarget#.TYPE#) +owner -> FirRegularClassSymbol util/Anno +context -> FirRegularClassSymbol util/Anno + +@Anno((String(MyClassWithoutConstructor nested nested super type ref ), prop#)) +owner -> FirRegularClassSymbol util/MyClassWithoutConstructor +context -> FirConstructorSymbol util/MyClassWithoutConstructor.MyClassWithoutConstructor +context -> FirConstructorSymbol util/MyClassWithoutConstructor.MyClassWithoutConstructor +context -> FirRegularClassSymbol util/MyClassWithoutConstructor + +@Anno((String(MyClassWithoutConstructor nested super type ref ), prop#)) +owner -> FirRegularClassSymbol util/MyClassWithoutConstructor +context -> FirConstructorSymbol util/MyClassWithoutConstructor.MyClassWithoutConstructor +context -> FirConstructorSymbol util/MyClassWithoutConstructor.MyClassWithoutConstructor +context -> FirRegularClassSymbol util/MyClassWithoutConstructor + +@Anno((String(MyClassWithoutConstructor super type call ), prop#)) +owner -> FirRegularClassSymbol util/MyClassWithoutConstructor +context -> FirConstructorSymbol util/MyClassWithoutConstructor.MyClassWithoutConstructor +context -> FirConstructorSymbol util/MyClassWithoutConstructor.MyClassWithoutConstructor +context -> FirRegularClassSymbol util/MyClassWithoutConstructor + +@Anno((String(MyClassWithConstructor nested nested super type ref ), prop#)) +owner -> FirRegularClassSymbol util/MyClassWithConstructor +context -> FirConstructorSymbol util/MyClassWithConstructor.MyClassWithConstructor +context -> FirConstructorSymbol util/MyClassWithConstructor.MyClassWithConstructor +context -> FirRegularClassSymbol util/MyClassWithConstructor + +@Anno((String(MyClassWithConstructor nested super type ref ), prop#)) +owner -> FirRegularClassSymbol util/MyClassWithConstructor +context -> FirConstructorSymbol util/MyClassWithConstructor.MyClassWithConstructor +context -> FirConstructorSymbol util/MyClassWithConstructor.MyClassWithConstructor +context -> FirRegularClassSymbol util/MyClassWithConstructor + +@Anno((String(MyClassWithConstructor super type call ), prop#)) +owner -> FirRegularClassSymbol util/MyClassWithConstructor +context -> FirConstructorSymbol util/MyClassWithConstructor.MyClassWithConstructor +context -> FirConstructorSymbol util/MyClassWithConstructor.MyClassWithConstructor +context -> FirRegularClassSymbol util/MyClassWithConstructor diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnNullableParenthesizedTypes.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnNullableParenthesizedTypes.annotationOwners.txt new file mode 100644 index 00000000000..cc23f30e9f0 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnNullableParenthesizedTypes.annotationOwners.txt @@ -0,0 +1,51 @@ +@A() +owner -> FirNamedFunctionSymbol /AnnotationsOnNullableParenthesizedTypes.receiverArgument +context -> FirNamedFunctionSymbol /AnnotationsOnNullableParenthesizedTypes.receiverArgument + +@A() +owner -> FirNamedFunctionSymbol /AnnotationsOnNullableParenthesizedTypes.parameter +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /AnnotationsOnNullableParenthesizedTypes.parameter + +@A() +owner -> FirNamedFunctionSymbol /AnnotationsOnNullableParenthesizedTypes.parameterArgument +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /AnnotationsOnNullableParenthesizedTypes.parameterArgument + +@A() +owner -> FirNamedFunctionSymbol /AnnotationsOnNullableParenthesizedTypes.returnValue +context -> FirNamedFunctionSymbol /AnnotationsOnNullableParenthesizedTypes.returnValue + +@A() +owner -> FirNamedFunctionSymbol /AnnotationsOnNullableParenthesizedTypes.returnTypeParameterValue +context -> FirNamedFunctionSymbol /AnnotationsOnNullableParenthesizedTypes.returnTypeParameterValue + +@A() +owner -> FirNamedFunctionSymbol /AnnotationsOnNullableParenthesizedTypes.returnArgument +context -> FirNamedFunctionSymbol /AnnotationsOnNullableParenthesizedTypes.returnArgument + +@A() +owner -> FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaType +context -> FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaType +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaType +context -> FirBackingFieldSymbol /field from FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaType + +@A() +owner -> FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaParameter +context -> FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaParameter +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaParameter +context -> FirBackingFieldSymbol /field from FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaParameter + +@A() +owner -> FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaReturnValue +context -> FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaReturnValue +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaReturnValue +context -> FirBackingFieldSymbol /field from FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaReturnValue + +@A() +owner -> FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaReceiver +context -> FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaReceiver +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaReceiver +context -> FirBackingFieldSymbol /field from FirPropertySymbol /AnnotationsOnNullableParenthesizedTypes.lambdaReceiver + +@Target(AnnotationTarget#.TYPE#, AnnotationTarget#.TYPE_PARAMETER#) +owner -> FirRegularClassSymbol A +context -> FirRegularClassSymbol A diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.annotationOwners.txt new file mode 100644 index 00000000000..053248a7b7d --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.annotationOwners.txt @@ -0,0 +1,57 @@ +@A() +owner -> FirNamedFunctionSymbol /AnnotationsOnParenthesizedTypes.receiverArgument +context -> FirNamedFunctionSymbol /AnnotationsOnParenthesizedTypes.receiverArgument + +@A() +owner -> FirNamedFunctionSymbol /AnnotationsOnParenthesizedTypes.parameter +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /AnnotationsOnParenthesizedTypes.parameter + +@A() +owner -> FirNamedFunctionSymbol /AnnotationsOnParenthesizedTypes.parameterArgument +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /AnnotationsOnParenthesizedTypes.parameterArgument + +@A() +owner -> FirNamedFunctionSymbol /AnnotationsOnParenthesizedTypes.returnValue +context -> FirNamedFunctionSymbol /AnnotationsOnParenthesizedTypes.returnValue + +@A() +owner -> FirNamedFunctionSymbol /AnnotationsOnParenthesizedTypes.returnTypeParameterValue +context -> FirNamedFunctionSymbol /AnnotationsOnParenthesizedTypes.returnTypeParameterValue + +@A() +owner -> FirNamedFunctionSymbol /AnnotationsOnParenthesizedTypes.returnArgument +context -> FirNamedFunctionSymbol /AnnotationsOnParenthesizedTypes.returnArgument + +@A() +owner -> FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaType +context -> FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaType +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaType +context -> FirBackingFieldSymbol /field from FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaType + +@A() +owner -> FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaParameter +context -> FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaParameter +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaParameter +context -> FirBackingFieldSymbol /field from FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaParameter + +@A() +owner -> FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaReturnValue +context -> FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaReturnValue +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaReturnValue +context -> FirBackingFieldSymbol /field from FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaReturnValue + +@A() +owner -> FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaReceiver +context -> FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaReceiver +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaReceiver +context -> FirBackingFieldSymbol /field from FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaReceiver + +@A() +owner -> FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaParameterNP +context -> FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaParameterNP +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaParameterNP +context -> FirBackingFieldSymbol /field from FirPropertySymbol /AnnotationsOnParenthesizedTypes.lambdaParameterNP + +@Target(AnnotationTarget#.TYPE#, AnnotationTarget#.TYPE_PARAMETER#) +owner -> FirRegularClassSymbol A +context -> FirRegularClassSymbol A diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/anonymousObjectWithAnnotation.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/anonymousObjectWithAnnotation.annotationOwners.txt new file mode 100644 index 00000000000..52808de5bd2 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/anonymousObjectWithAnnotation.annotationOwners.txt @@ -0,0 +1,33 @@ +@SuperType(String(nested nested super type)) +owner -> FirPropertySymbol /prop +context -> FirAnonymousObjectSymbol from FirPropertySymbol /prop +context -> FirConstructorSymbol /. from FirAnonymousObjectSymbol from FirPropertySymbol /prop +context -> FirConstructorSymbol /. from FirAnonymousObjectSymbol from FirPropertySymbol /prop + +@SuperType(String(nested super type)) +owner -> FirPropertySymbol /prop +context -> FirAnonymousObjectSymbol from FirPropertySymbol /prop +context -> FirConstructorSymbol /. from FirAnonymousObjectSymbol from FirPropertySymbol /prop +context -> FirConstructorSymbol /. from FirAnonymousObjectSymbol from FirPropertySymbol /prop + +@SuperType(String(super type)) +owner -> FirPropertySymbol /prop +context -> FirAnonymousObjectSymbol from FirPropertySymbol /prop +context -> FirConstructorSymbol /. from FirAnonymousObjectSymbol from FirPropertySymbol /prop +context -> FirConstructorSymbol /. from FirAnonymousObjectSymbol from FirPropertySymbol /prop + +@Anno(String(init)) +owner -> FirAnonymousInitializerSymbol +context -> FirAnonymousInitializerSymbol from FirAnonymousObjectSymbol from FirPropertySymbol /prop + +@Expression(String(expr)) +owner -> FirAnonymousInitializerSymbol +context -> FirAnonymousInitializerSymbol from FirAnonymousObjectSymbol from FirPropertySymbol /prop + +@Anno(String(lambda param type)) +owner -> FirAnonymousInitializerSymbol +context -> FirValueParameterSymbol /it from FirAnonymousFunctionSymbol special/anonymous from FirAnonymousInitializerSymbol from FirAnonymousObjectSymbol from FirPropertySymbol /prop + +@Anno(String(object annotation)) +owner -> FirPropertySymbol /prop +context -> FirAnonymousObjectSymbol from FirPropertySymbol /prop diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorWithLocalDeclarations.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorWithLocalDeclarations.annotationOwners.txt new file mode 100644 index 00000000000..7af91dec6c5 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorWithLocalDeclarations.annotationOwners.txt @@ -0,0 +1,11 @@ +@Anno((String(nested nested bar ), prop#)) +owner -> FirNamedFunctionSymbol /bar +context -> FirNamedFunctionSymbol /bar from FirRegularClassSymbol /LocalIntoLocal from FirConstructorSymbol util/A.A + +@Anno((String(nested bar ), prop#)) +owner -> FirNamedFunctionSymbol /bar +context -> FirNamedFunctionSymbol /bar from FirRegularClassSymbol /LocalIntoLocal from FirConstructorSymbol util/A.A + +@Anno((String(bar ), prop#)) +owner -> FirNamedFunctionSymbol /bar +context -> FirNamedFunctionSymbol /bar from FirRegularClassSymbol /LocalIntoLocal from FirConstructorSymbol util/A.A diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsClassLevel.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsClassLevel.annotationOwners.txt new file mode 100644 index 00000000000..848e9015daa --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsClassLevel.annotationOwners.txt @@ -0,0 +1,39 @@ +@Suppress(String()) +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirRegularClassSymbol A + +@MustBeDocumented() +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirRegularClassSymbol A + +@Suppress(String()) +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirRegularClassSymbol B + +@MustBeDocumented() +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirRegularClassSymbol B + +@Suppress(String()) +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirRegularClassSymbol Outer.Inner + +@MustBeDocumented() +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirRegularClassSymbol Outer.Inner + +@Suppress(String()) +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /Outer.withLocal + +@MustBeDocumented() +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /Outer.withLocal + +@Suppress(String()) +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirAnonymousObjectSymbol from FirPropertySymbol /r from FirNamedFunctionSymbol /Outer.withLocal + +@MustBeDocumented() +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirAnonymousObjectSymbol from FirPropertySymbol /r from FirNamedFunctionSymbol /Outer.withLocal diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsFileLevel.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsFileLevel.annotationOwners.txt new file mode 100644 index 00000000000..aaae133e1d8 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsFileLevel.annotationOwners.txt @@ -0,0 +1,7 @@ +@Suppress(String()) +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirFileSymbol danglingAnnotationsFileLevel.kt + +@MustBeDocumented() +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirFileSymbol danglingAnnotationsFileLevel.kt diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/dataClassWithAnnotations.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/dataClassWithAnnotations.annotationOwners.txt new file mode 100644 index 00000000000..29528ad1fab --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/dataClassWithAnnotations.annotationOwners.txt @@ -0,0 +1,107 @@ +@Anno((String(nested nested Derived b parameter type ), x#)) +owner -> FirConstructorSymbol /Derived.Derived +context -> FirValueParameterSymbol /b from FirConstructorSymbol /Derived.Derived +context -> FirPropertySymbol /Derived.b +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /Derived.b +context -> FirBackingFieldSymbol /field from FirPropertySymbol /Derived.b +context -> FirNamedFunctionSymbol /Derived.component1 +context -> FirValueParameterSymbol /b from FirNamedFunctionSymbol /Derived.copy + +@Anno((String(nested Derived b parameter type ), x#)) +owner -> FirConstructorSymbol /Derived.Derived +context -> FirValueParameterSymbol /b from FirConstructorSymbol /Derived.Derived +context -> FirPropertySymbol /Derived.b +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /Derived.b +context -> FirBackingFieldSymbol /field from FirPropertySymbol /Derived.b +context -> FirNamedFunctionSymbol /Derived.component1 +context -> FirValueParameterSymbol /b from FirNamedFunctionSymbol /Derived.copy + +@Anno((String(Derived b parameter type ), x#)) +owner -> FirConstructorSymbol /Derived.Derived +context -> FirValueParameterSymbol /b from FirConstructorSymbol /Derived.Derived +context -> FirPropertySymbol /Derived.b +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /Derived.b +context -> FirBackingFieldSymbol /field from FirPropertySymbol /Derived.b +context -> FirNamedFunctionSymbol /Derived.component1 +context -> FirValueParameterSymbol /b from FirNamedFunctionSymbol /Derived.copy + +@Anno((String(b ), x#)) +owner -> FirConstructorSymbol /Derived.Derived +context -> FirValueParameterSymbol /b from FirConstructorSymbol /Derived.Derived + +@CONSTRUCTOR_PARAMETER:Anno((String(param: b ), x#)) +owner -> FirConstructorSymbol /Derived.Derived +context -> FirValueParameterSymbol /b from FirConstructorSymbol /Derived.Derived + +@Anno((String(nested nested Derived c parameter type ), x#)) +owner -> FirConstructorSymbol /Derived.Derived +context -> FirValueParameterSymbol /c from FirConstructorSymbol /Derived.Derived +context -> FirPropertySymbol /Derived.c +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /Derived.c +context -> FirBackingFieldSymbol /field from FirPropertySymbol /Derived.c +context -> FirNamedFunctionSymbol /Derived.component2 +context -> FirValueParameterSymbol /c from FirNamedFunctionSymbol /Derived.copy + +@Anno((String(nested Derived c parameter type ), x#)) +owner -> FirConstructorSymbol /Derived.Derived +context -> FirValueParameterSymbol /c from FirConstructorSymbol /Derived.Derived +context -> FirPropertySymbol /Derived.c +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /Derived.c +context -> FirBackingFieldSymbol /field from FirPropertySymbol /Derived.c +context -> FirNamedFunctionSymbol /Derived.component2 +context -> FirValueParameterSymbol /c from FirNamedFunctionSymbol /Derived.copy + +@Anno((String(Derived c parameter type ), x#)) +owner -> FirConstructorSymbol /Derived.Derived +context -> FirValueParameterSymbol /c from FirConstructorSymbol /Derived.Derived +context -> FirPropertySymbol /Derived.c +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /Derived.c +context -> FirBackingFieldSymbol /field from FirPropertySymbol /Derived.c +context -> FirNamedFunctionSymbol /Derived.component2 +context -> FirValueParameterSymbol /c from FirNamedFunctionSymbol /Derived.copy + +@Anno((String(Derived constructor ), x#)) +owner -> FirConstructorSymbol /Derived.Derived +context -> FirConstructorSymbol /Derived.Derived + +@Anno((String(nested nested super type call ), x#)) +owner -> FirRegularClassSymbol Derived +context -> FirConstructorSymbol /Derived.Derived +context -> FirConstructorSymbol /Derived.Derived +context -> FirRegularClassSymbol Derived + +@Anno((String(nested super type call ), x#)) +owner -> FirRegularClassSymbol Derived +context -> FirConstructorSymbol /Derived.Derived +context -> FirConstructorSymbol /Derived.Derived +context -> FirRegularClassSymbol Derived + +@Anno((String(Base super type call ), x#)) +owner -> FirRegularClassSymbol Derived +context -> FirConstructorSymbol /Derived.Derived +context -> FirConstructorSymbol /Derived.Derived +context -> FirRegularClassSymbol Derived + +@PROPERTY_GETTER:Anno((String(get: b ), x#)) +owner -> FirPropertySymbol /Derived.b +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /Derived.b + +@Anno((String(b ), x#)) +owner -> FirPropertySymbol /Derived.b +context -> FirPropertySymbol /Derived.b + +@PROPERTY:Anno((String(property: b ), x#)) +owner -> FirPropertySymbol /Derived.b +context -> FirPropertySymbol /Derived.b + +@Anno((String(b ), x#)) +owner -> FirRegularClassSymbol Derived +context -> FirValueParameterSymbol /b from FirNamedFunctionSymbol /Derived.copy + +@Anno((String(param: b ), x#)) +owner -> FirRegularClassSymbol Derived +context -> FirValueParameterSymbol /b from FirNamedFunctionSymbol /Derived.copy + +@Anno((String(Derived ), x#)) +owner -> FirRegularClassSymbol Derived +context -> FirRegularClassSymbol Derived diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegatedFieldNestedName.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegatedFieldNestedName.annotationOwners.txt new file mode 100644 index 00000000000..eb031ab50f6 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegatedFieldNestedName.annotationOwners.txt @@ -0,0 +1,48 @@ +@Target(AnnotationTarget#.TYPE#) +owner -> FirRegularClassSymbol second/Anno +context -> FirRegularClassSymbol second/Anno + +@Anno(IntegerLiteral(2).plus#(outer#)) +owner -> FirRegularClassSymbol second/MyClass +context -> FirFieldSymbol second/MyClass.$$delegate_0 +context -> FirRegularClassSymbol second/MyClass + +@Anno(IntegerLiteral(1).plus#(outer#)) +owner -> FirRegularClassSymbol second/MyClass +context -> FirFieldSymbol second/MyClass.$$delegate_0 +context -> FirRegularClassSymbol second/MyClass + +@Anno(IntegerLiteral(0).plus#(outer#)) +owner -> FirRegularClassSymbol second/MyClass +context -> FirFieldSymbol second/MyClass.$$delegate_0 +context -> FirRegularClassSymbol second/MyClass + +@Anno(IntegerLiteral(5).plus#(outer#)) +owner -> FirRegularClassSymbol second/MyClass +context -> FirFieldSymbol second/MyClass.$$delegate_1 +context -> FirRegularClassSymbol second/MyClass + +@Anno(IntegerLiteral(4).plus#(outer#)) +owner -> FirRegularClassSymbol second/MyClass +context -> FirFieldSymbol second/MyClass.$$delegate_1 +context -> FirRegularClassSymbol second/MyClass + +@Anno(IntegerLiteral(8).plus#(inner#)) +owner -> FirRegularClassSymbol second/MyClass.Companion +context -> FirRegularClassSymbol second/MyClass.Companion + +@Anno(IntegerLiteral(7).plus#(inner#)) +owner -> FirRegularClassSymbol second/MyClass.Companion +context -> FirRegularClassSymbol second/MyClass.Companion + +@Anno(IntegerLiteral(6).plus#(inner#)) +owner -> FirRegularClassSymbol second/MyClass.Companion +context -> FirRegularClassSymbol second/MyClass.Companion + +@Anno(IntegerLiteral(10).plus#(inner#)) +owner -> FirRegularClassSymbol second/MyClass.NestedObject +context -> FirRegularClassSymbol second/MyClass.NestedObject + +@Anno(IntegerLiteral(9).plus#(inner#)) +owner -> FirRegularClassSymbol second/MyClass.NestedObject +context -> FirRegularClassSymbol second/MyClass.NestedObject diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegatesWithAnnotations.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegatesWithAnnotations.annotationOwners.txt new file mode 100644 index 00000000000..43ae8a09e01 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegatesWithAnnotations.annotationOwners.txt @@ -0,0 +1,67 @@ +@Anno((String(x annotation ), x#)) +owner -> FirPropertySymbol /x +context -> FirPropertySymbol /x + +@Anno((String(ReadWriteProperty first type argument ), x#)) +owner -> FirPropertySymbol /delegate +context -> FirAnonymousObjectSymbol from FirPropertySymbol /delegate + +@Anno((String(ReadWriteProperty second type argument ), x#)) +owner -> FirPropertySymbol /delegate +context -> FirAnonymousObjectSymbol from FirPropertySymbol /delegate + +@Anno((String(getValue return type ), x#)) +owner -> FirNamedFunctionSymbol /.getValue +context -> FirNamedFunctionSymbol /.getValue from FirAnonymousObjectSymbol from FirPropertySymbol /delegate + +@Anno((String(getValue ), x#)) +owner -> FirNamedFunctionSymbol /.getValue +context -> FirNamedFunctionSymbol /.getValue from FirAnonymousObjectSymbol from FirPropertySymbol /delegate + +@Anno((String(setValue value parameter type ), x#)) +owner -> FirNamedFunctionSymbol /.setValue +context -> FirValueParameterSymbol /value from FirNamedFunctionSymbol /.setValue from FirAnonymousObjectSymbol from FirPropertySymbol /delegate + +@Anno((String(setValue ), x#)) +owner -> FirNamedFunctionSymbol /.setValue +context -> FirNamedFunctionSymbol /.setValue from FirAnonymousObjectSymbol from FirPropertySymbol /delegate + +@PROPERTY_DELEGATE_FIELD:Anno((String(delegate: delegate annotation ), x#)) +owner -> FirPropertySymbol /delegate +context -> FirBackingFieldSymbol /field from FirPropertySymbol /delegate + +@Anno((String(delegate annotation ), x#)) +owner -> FirPropertySymbol /delegate +context -> FirPropertySymbol /delegate + +@PROPERTY_GETTER:Anno((String(get: value annotation ), x#)) +owner -> FirPropertySymbol /value +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /value + +@PROPERTY_DELEGATE_FIELD:Anno((String(delegate: value annotation ), x#)) +owner -> FirPropertySymbol /value +context -> FirBackingFieldSymbol /field from FirPropertySymbol /value + +@Anno((String(value annotation ), x#)) +owner -> FirPropertySymbol /value +context -> FirPropertySymbol /value + +@PROPERTY_GETTER:Anno((String(get: value annotation ), x#)) +owner -> FirPropertySymbol /variable +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /variable + +@SETTER_PARAMETER:Anno((String(setparam: value annotation ), x#)) +owner -> FirPropertySymbol /variable +context -> FirValueParameterSymbol /variable from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /variable + +@PROPERTY_SETTER:Anno((String(set: value annotation ), x#)) +owner -> FirPropertySymbol /variable +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /variable + +@PROPERTY_DELEGATE_FIELD:Anno((String(delegate: value annotation ), x#)) +owner -> FirPropertySymbol /variable +context -> FirBackingFieldSymbol /field from FirPropertySymbol /variable + +@Anno((String(variable annotation ), x#)) +owner -> FirPropertySymbol /variable +context -> FirPropertySymbol /variable diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enumEntryWithAnnotations.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enumEntryWithAnnotations.annotationOwners.txt new file mode 100644 index 00000000000..88dba25123b --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enumEntryWithAnnotations.annotationOwners.txt @@ -0,0 +1,31 @@ +@Anno(String(init annotations)) +owner -> FirAnonymousInitializerSymbol +context -> FirAnonymousInitializerSymbol from FirAnonymousObjectSymbol from FirEnumEntrySymbol /MyEnumClass.ENUM_ENTRY + +@Expression(String(expression annotation)) +owner -> FirAnonymousInitializerSymbol +context -> FirAnonymousInitializerSymbol from FirAnonymousObjectSymbol from FirEnumEntrySymbol /MyEnumClass.ENUM_ENTRY + +@Anno(String(nested return type)) +owner -> FirNamedFunctionSymbol /.foo +context -> FirNamedFunctionSymbol /.foo from FirAnonymousObjectSymbol from FirEnumEntrySymbol /MyEnumClass.ENUM_ENTRY + +@Anno(String(return type)) +owner -> FirNamedFunctionSymbol /.foo +context -> FirNamedFunctionSymbol /.foo from FirAnonymousObjectSymbol from FirEnumEntrySymbol /MyEnumClass.ENUM_ENTRY + +@FunAnno(String(fun)) +owner -> FirNamedFunctionSymbol /.foo +context -> FirNamedFunctionSymbol /.foo from FirAnonymousObjectSymbol from FirEnumEntrySymbol /MyEnumClass.ENUM_ENTRY + +@Anno(String(implicit)) +owner -> FirEnumEntrySymbol /MyEnumClass.ENUM_ENTRY +context -> FirEnumEntrySymbol /MyEnumClass.ENUM_ENTRY + +@PROPERTY:Anno(String(explicit)) +owner -> FirEnumEntrySymbol /MyEnumClass.ENUM_ENTRY +context -> FirEnumEntrySymbol /MyEnumClass.ENUM_ENTRY + +@EnumAnnotation(String(enum)) +owner -> FirRegularClassSymbol MyEnumClass +context -> FirRegularClassSymbol MyEnumClass diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/fileAnnotations.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/fileAnnotations.annotationOwners.txt new file mode 100644 index 00000000000..cc16d30f2d6 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/fileAnnotations.annotationOwners.txt @@ -0,0 +1,15 @@ +@FILE:FileAnnotation(String(file annotation)) +owner -> FirFileSymbol fileAnnotations.kt +context -> FirFileSymbol fileAnnotations.kt + +@FILE:Annotation1(String(foo)) +owner -> FirFileSymbol fileAnnotations.kt +context -> FirFileSymbol fileAnnotations.kt + +@FILE:Annotation2() +owner -> FirFileSymbol fileAnnotations.kt +context -> FirFileSymbol fileAnnotations.kt + +@WithouTarget(String(argument)) +owner -> FirFileSymbol fileAnnotations.kt +context -> FirFileSymbol fileAnnotations.kt diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/fileAnnotationsWithoutPackage.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/fileAnnotationsWithoutPackage.annotationOwners.txt new file mode 100644 index 00000000000..b7e2c7bcb52 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/fileAnnotationsWithoutPackage.annotationOwners.txt @@ -0,0 +1,15 @@ +@FILE:FileAnnotation(String(file annotation)) +owner -> FirFileSymbol fileAnnotationsWithoutPackage.kt +context -> FirFileSymbol fileAnnotationsWithoutPackage.kt + +@FILE:Annotation1(String(foo)) +owner -> FirFileSymbol fileAnnotationsWithoutPackage.kt +context -> FirFileSymbol fileAnnotationsWithoutPackage.kt + +@FILE:Annotation2() +owner -> FirFileSymbol fileAnnotationsWithoutPackage.kt +context -> FirFileSymbol fileAnnotationsWithoutPackage.kt + +@WithouTarget(String(argument)) +owner -> FirDanglingModifierSymbol +context -> FirDanglingModifierSymbol from FirFileSymbol fileAnnotationsWithoutPackage.kt diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/initWithLocalDeclarations.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/initWithLocalDeclarations.annotationOwners.txt new file mode 100644 index 00000000000..1cce66facf5 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/initWithLocalDeclarations.annotationOwners.txt @@ -0,0 +1,11 @@ +@Anno((String(nested nested bar ), prop#)) +owner -> FirNamedFunctionSymbol /bar +context -> FirNamedFunctionSymbol /bar from FirRegularClassSymbol /LocalIntoLocal from FirAnonymousInitializerSymbol from FirRegularClassSymbol util/A + +@Anno((String(nested bar ), prop#)) +owner -> FirNamedFunctionSymbol /bar +context -> FirNamedFunctionSymbol /bar from FirRegularClassSymbol /LocalIntoLocal from FirAnonymousInitializerSymbol from FirRegularClassSymbol util/A + +@Anno((String(bar ), prop#)) +owner -> FirNamedFunctionSymbol /bar +context -> FirNamedFunctionSymbol /bar from FirRegularClassSymbol /LocalIntoLocal from FirAnonymousInitializerSymbol from FirRegularClassSymbol util/A diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/localAnnotations.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/localAnnotations.annotationOwners.txt new file mode 100644 index 00000000000..a9210b357da --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/localAnnotations.annotationOwners.txt @@ -0,0 +1,987 @@ +@Anno2() +owner -> FirNamedFunctionSymbol /foo +context -> FirPropertySymbol /a from FirNamedFunctionSymbol /foo + +@Anno1() +owner -> FirNamedFunctionSymbol /foo +context -> FirPropertySymbol /a from FirNamedFunctionSymbol /foo + +@AnonymousFunction() +owner -> FirNamedFunctionSymbol /foo +context -> FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirNamedFunctionSymbol /foo + +@AnonymousParameterType() +owner -> FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /a from FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirNamedFunctionSymbol /foo + +@AnonymousParameter() +owner -> FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /a from FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /foo + +@NestedNestedSuperType() +owner -> FirRegularClassSymbol /Local +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperType() +owner -> FirRegularClassSymbol /Local +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperType() +owner -> FirRegularClassSymbol /Local +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local +context -> FirFieldSymbol /Local.$$delegate_0 from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local +context -> FirFieldSymbol /Local.$$delegate_0 from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperDelegateType() +owner -> FirRegularClassSymbol /Local +context -> FirFieldSymbol /Local.$$delegate_0 from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno2() +owner -> FirPropertySymbol /a +context -> FirPropertySymbol /a from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno1() +owner -> FirPropertySymbol /a +context -> FirPropertySymbol /a from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@AnonymousFunction() +owner -> FirPropertySymbol /b +context -> FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@AnonymousParameterType() +owner -> FirPropertySymbol /b +context -> FirValueParameterSymbol /a from FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@AnonymousParameter() +owner -> FirPropertySymbol /b +context -> FirValueParameterSymbol /a from FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /b +context -> FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /boo +context -> FirNamedFunctionSymbol /boo from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /boo +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /boo +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /boo +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /boo +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /boo +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /boo +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /boo +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /boo +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /boo +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /boo +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /boo +context -> FirNamedFunctionSymbol /boo from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local +context -> FirConstructorSymbol /Local.LocalNested.Local.Local from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.Local.Local from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local +context -> FirConstructorSymbol /Local.LocalNested.Local.Local from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.Local.Local from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local +context -> FirConstructorSymbol /Local.LocalNested.Local.Local from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.Local.Local from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local +context -> FirFieldSymbol /Local.LocalNested.Local.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local +context -> FirFieldSymbol /Local.LocalNested.Local.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local +context -> FirFieldSymbol /Local.LocalNested.Local.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested.Local.LocalNested from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@FunType() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno2() +owner -> FirNamedFunctionSymbol /localMember +context -> FirPropertySymbol /a from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno1() +owner -> FirNamedFunctionSymbol /localMember +context -> FirPropertySymbol /a from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@AnonymousFunction() +owner -> FirNamedFunctionSymbol /localMember +context -> FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@AnonymousParameterType() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@AnonymousParameter() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperType() +owner -> FirRegularClassSymbol /Local +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperType() +owner -> FirRegularClassSymbol /Local +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperType() +owner -> FirRegularClassSymbol /Local +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local +context -> FirFieldSymbol /Local.$$delegate_0 from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local +context -> FirFieldSymbol /Local.$$delegate_0 from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperDelegateType() +owner -> FirRegularClassSymbol /Local +context -> FirFieldSymbol /Local.$$delegate_0 from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@FunType() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Fun() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PropType() +owner -> FirPropertySymbol /localProperty +context -> FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /value from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirBackingFieldSymbol /field from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PROPERTY_GETTER:Getter() +owner -> FirPropertySymbol /localProperty +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SETTER_PARAMETER:Parameter() +owner -> FirPropertySymbol /localProperty +context -> FirValueParameterSymbol /value from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PROPERTY_SETTER:Setter() +owner -> FirPropertySymbol /localProperty +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Prop() +owner -> FirPropertySymbol /localProperty +context -> FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperInterfaceType() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Fun() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PropType() +owner -> FirPropertySymbol /localProperty +context -> FirPropertySymbol /localProperty from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /value from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirBackingFieldSymbol /field from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PROPERTY_GETTER:Getter() +owner -> FirPropertySymbol /localProperty +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SETTER_PARAMETER:Parameter() +owner -> FirPropertySymbol /localProperty +context -> FirValueParameterSymbol /value from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PROPERTY_SETTER:Setter() +owner -> FirPropertySymbol /localProperty +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Prop() +owner -> FirPropertySymbol /localProperty +context -> FirPropertySymbol /localProperty from FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirRegularClassSymbol /Local.LocalNested.Local +context -> FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local +context -> FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local +context -> FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested.Local +context -> FirRegularClassSymbol /Local.LocalNested.Local from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@FunType() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno2() +owner -> FirNamedFunctionSymbol /localMember +context -> FirPropertySymbol /a from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno1() +owner -> FirNamedFunctionSymbol /localMember +context -> FirPropertySymbol /a from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@AnonymousFunction() +owner -> FirNamedFunctionSymbol /localMember +context -> FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@AnonymousParameterType() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@AnonymousParameter() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperType() +owner -> FirRegularClassSymbol /Local +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperType() +owner -> FirRegularClassSymbol /Local +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperType() +owner -> FirRegularClassSymbol /Local +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local +context -> FirFieldSymbol /Local.$$delegate_0 from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local +context -> FirFieldSymbol /Local.$$delegate_0 from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperDelegateType() +owner -> FirRegularClassSymbol /Local +context -> FirFieldSymbol /Local.$$delegate_0 from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@FunType() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Fun() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PropType() +owner -> FirPropertySymbol /localProperty +context -> FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirBackingFieldSymbol /field from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno2() +owner -> FirPropertySymbol /localProperty +context -> FirPropertySymbol /a from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno1() +owner -> FirPropertySymbol /localProperty +context -> FirPropertySymbol /a from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@AnonymousFunction() +owner -> FirPropertySymbol /localProperty +context -> FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@AnonymousParameterType() +owner -> FirPropertySymbol /localProperty +context -> FirValueParameterSymbol /a from FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@AnonymousParameter() +owner -> FirPropertySymbol /localProperty +context -> FirValueParameterSymbol /a from FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirAnonymousFunctionSymbol special/anonymous from FirPropertySymbol /b from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirNamedFunctionSymbol /boo from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirValueParameterSymbol /a from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirNamedFunctionSymbol /boo from FirNamedFunctionSymbol /boo from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirPropertySymbol /localProperty +context -> FirNamedFunctionSymbol /boo from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperType() +owner -> FirRegularClassSymbol /Local +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperType() +owner -> FirRegularClassSymbol /Local +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperType() +owner -> FirRegularClassSymbol /Local +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.Local from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local +context -> FirFieldSymbol /Local.$$delegate_0 from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local +context -> FirFieldSymbol /Local.$$delegate_0 from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperDelegateType() +owner -> FirRegularClassSymbol /Local +context -> FirFieldSymbol /Local.$$delegate_0 from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirConstructorSymbol /Local.LocalNested.LocalNested from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperDelegateType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirFieldSymbol /Local.LocalNested.$$delegate_0 from FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperInterfaceType() +owner -> FirRegularClassSymbol /Local.LocalNested +context -> FirRegularClassSymbol /Local.LocalNested from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@FunType() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Fun() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PropType() +owner -> FirPropertySymbol /localProperty +context -> FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /value from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirBackingFieldSymbol /field from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PROPERTY_GETTER:Getter() +owner -> FirPropertySymbol /localProperty +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SETTER_PARAMETER:Parameter() +owner -> FirPropertySymbol /localProperty +context -> FirValueParameterSymbol /value from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PROPERTY_SETTER:Setter() +owner -> FirPropertySymbol /localProperty +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Prop() +owner -> FirPropertySymbol /localProperty +context -> FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperInterfaceType() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperInterfaceType() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Fun() +owner -> FirNamedFunctionSymbol /localMember +context -> FirNamedFunctionSymbol /localMember from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PropType() +owner -> FirPropertySymbol /localProperty +context -> FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirValueParameterSymbol /value from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo +context -> FirBackingFieldSymbol /field from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PROPERTY_GETTER:Getter() +owner -> FirPropertySymbol /localProperty +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SETTER_PARAMETER:Parameter() +owner -> FirPropertySymbol /localProperty +context -> FirValueParameterSymbol /value from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@PROPERTY_SETTER:Setter() +owner -> FirPropertySymbol /localProperty +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Prop() +owner -> FirPropertySymbol /localProperty +context -> FirPropertySymbol /localProperty from FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@Anno() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedNestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@NestedSuperInterfaceType() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo + +@SuperInterfaceType() +owner -> FirRegularClassSymbol /Local +context -> FirRegularClassSymbol /Local from FirNamedFunctionSymbol /foo diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/localImplicitType.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/localImplicitType.annotationOwners.txt new file mode 100644 index 00000000000..29f92c875f1 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/localImplicitType.annotationOwners.txt @@ -0,0 +1,32 @@ +@Anno((C#)) +owner -> FirPropertySymbol /foo +context -> FirPropertySymbol /foo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /foo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check +context -> FirValueParameterSymbol /value from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /foo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check +context -> FirBackingFieldSymbol /field from FirPropertySymbol /foo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check + +@Anno((C#)) +owner -> FirPropertySymbol /foo +context -> FirPropertySymbol /foo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /foo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check +context -> FirValueParameterSymbol /value from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /foo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check +context -> FirBackingFieldSymbol /field from FirPropertySymbol /foo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check + +@Anno((C#)) +owner -> FirPropertySymbol /foo +context -> FirPropertySymbol /foo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check +context -> FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /foo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check +context -> FirValueParameterSymbol /value from FirPropertyAccessorSymbol special/accessor from FirPropertySymbol /foo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check +context -> FirBackingFieldSymbol /field from FirPropertySymbol /foo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check + +@Anno((C#)) +owner -> FirNamedFunctionSymbol /doo +context -> FirNamedFunctionSymbol /doo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check + +@Anno((C#)) +owner -> FirNamedFunctionSymbol /doo +context -> FirNamedFunctionSymbol /doo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check + +@Anno((C#)) +owner -> FirNamedFunctionSymbol /doo +context -> FirNamedFunctionSymbol /doo from FirRegularClassSymbol /A.B from FirRegularClassSymbol /A from FirNamedFunctionSymbol second/check diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/multiDeclarations.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/multiDeclarations.annotationOwners.txt new file mode 100644 index 00000000000..86e84b47a4b --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/multiDeclarations.annotationOwners.txt @@ -0,0 +1,35 @@ +@ForAnno((String(for anno ), prop#)) +owner -> FirNamedFunctionSymbol util/foo +context -> FirNamedFunctionSymbol util/foo + +@ForParameter((String(for ), prop#)) +owner -> FirNamedFunctionSymbol util/foo +context -> FirPropertySymbol /i from FirNamedFunctionSymbol util/foo + +@ForParameter((String(second for ), prop#)) +owner -> FirNamedFunctionSymbol util/foo +context -> FirPropertySymbol / from FirNamedFunctionSymbol util/foo + +@NestedParam((String(destructuring in for ), prop#)) +owner -> FirNamedFunctionSymbol util/foo +context -> FirPropertySymbol /y from FirNamedFunctionSymbol util/foo + +@LeftLambda((String(lambda a ), prop#)) +owner -> FirNamedFunctionSymbol util/foo +context -> FirPropertySymbol /a from FirAnonymousFunctionSymbol special/anonymous from FirNamedFunctionSymbol util/foo + +@RightLambda((String(lambda b ), prop#)) +owner -> FirNamedFunctionSymbol util/foo +context -> FirPropertySymbol /b from FirAnonymousFunctionSymbol special/anonymous from FirNamedFunctionSymbol util/foo + +@Destructuring((String(destr ), prop#)) +owner -> FirNamedFunctionSymbol util/foo +context -> FirPropertySymbol / from FirNamedFunctionSymbol util/foo + +@LeftDestructuring((String(a ), prop#)) +owner -> FirNamedFunctionSymbol util/foo +context -> FirPropertySymbol /a from FirNamedFunctionSymbol util/foo + +@RightDestructuring((String(b ), prop#)) +owner -> FirNamedFunctionSymbol util/foo +context -> FirPropertySymbol /b from FirNamedFunctionSymbol util/foo diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptLevelDestructuringWithAnnotation.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptLevelDestructuringWithAnnotation.annotationOwners.txt new file mode 100644 index 00000000000..8db27122d7d --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptLevelDestructuringWithAnnotation.annotationOwners.txt @@ -0,0 +1,23 @@ +@DestrAnno((String(destr 1 ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol / from FirScriptSymbol util. from FirFileSymbol scriptLevelDestructuringWithAnnotation.kts + +@LeftAnno((String(a ), prop#)) +owner -> FirPropertySymbol /a +context -> FirPropertySymbol /a from FirScriptSymbol util. from FirFileSymbol scriptLevelDestructuringWithAnnotation.kts + +@RightAnno((String(b ), prop#)) +owner -> FirPropertySymbol /b +context -> FirPropertySymbol /b from FirScriptSymbol util. from FirFileSymbol scriptLevelDestructuringWithAnnotation.kts + +@Destr2Anno((String(destr 1 ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol / from FirScriptSymbol util. from FirFileSymbol scriptLevelDestructuringWithAnnotation.kts + +@SecondLeftAnno((String(c ), prop#)) +owner -> FirPropertySymbol /c +context -> FirPropertySymbol /c from FirScriptSymbol util. from FirFileSymbol scriptLevelDestructuringWithAnnotation.kts + +@SecondRightAnno((String(d ), prop#)) +owner -> FirPropertySymbol /d +context -> FirPropertySymbol /d from FirScriptSymbol util. from FirFileSymbol scriptLevelDestructuringWithAnnotation.kts diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotation.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotation.annotationOwners.txt new file mode 100644 index 00000000000..f29f511097c --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotation.annotationOwners.txt @@ -0,0 +1,23 @@ +@DestrAnno((String(destr 1 ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol / from FirScriptSymbol util. from FirFileSymbol scriptStatementLevelDestructuringWithAnnotation.kts + +@LeftAnno((String(a ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol /a from FirScriptSymbol util. from FirFileSymbol scriptStatementLevelDestructuringWithAnnotation.kts + +@RightAnno((String(b ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol /b from FirScriptSymbol util. from FirFileSymbol scriptStatementLevelDestructuringWithAnnotation.kts + +@Destr2Anno((String(destr 1 ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol / from FirScriptSymbol util. from FirFileSymbol scriptStatementLevelDestructuringWithAnnotation.kts + +@SecondLeftAnno((String(c ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol /c from FirScriptSymbol util. from FirFileSymbol scriptStatementLevelDestructuringWithAnnotation.kts + +@SecondRightAnno((String(d ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol /d from FirScriptSymbol util. from FirFileSymbol scriptStatementLevelDestructuringWithAnnotation.kts diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.annotationOwners.txt new file mode 100644 index 00000000000..00be3630819 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/scriptStatementLevelDestructuringWithAnnotationAsLastStatement.annotationOwners.txt @@ -0,0 +1,23 @@ +@DestrAnno((String(destr 1 ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol / from FirScriptSymbol util. from FirFileSymbol scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts + +@LeftAnno((String(a ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol /a from FirScriptSymbol util. from FirFileSymbol scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts + +@RightAnno((String(b ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol /b from FirScriptSymbol util. from FirFileSymbol scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts + +@Destr2Anno((String(destr 1 ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol / from FirScriptSymbol util. from FirFileSymbol scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts + +@SecondLeftAnno((String(c ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol /c from FirScriptSymbol util. from FirFileSymbol scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts + +@SecondRightAnno((String(d ), prop#)) +owner -> FirScriptSymbol util. +context -> FirPropertySymbol /d from FirScriptSymbol util. from FirFileSymbol scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/secondaryConstructor.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/secondaryConstructor.annotationOwners.txt new file mode 100644 index 00000000000..7bbb3dd0745 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/secondaryConstructor.annotationOwners.txt @@ -0,0 +1,15 @@ +@Target(AnnotationTarget#.TYPE#) +owner -> FirRegularClassSymbol util/Anno +context -> FirRegularClassSymbol util/Anno + +@Anno((String(nested nested super type ref ), prop#)) +owner -> FirRegularClassSymbol util/MyClass +context -> FirRegularClassSymbol util/MyClass + +@Anno((String(nested super type ref ), prop#)) +owner -> FirRegularClassSymbol util/MyClass +context -> FirRegularClassSymbol util/MyClass + +@Anno((String(super type call ), prop#)) +owner -> FirRegularClassSymbol util/MyClass +context -> FirRegularClassSymbol util/MyClass diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/splitModifierList.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/splitModifierList.annotationOwners.txt new file mode 100644 index 00000000000..5a5efb391e4 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/splitModifierList.annotationOwners.txt @@ -0,0 +1,87 @@ +@Target(AnnotationTarget#.TYPE#, AnnotationTarget#.TYPE_PARAMETER#) +owner -> FirRegularClassSymbol A +context -> FirRegularClassSymbol A + +@Target(AnnotationTarget#.TYPE#, AnnotationTarget#.TYPE_PARAMETER#) +owner -> FirRegularClassSymbol B +context -> FirRegularClassSymbol B + +@A() +owner -> FirTypeAliasSymbol Test0 +context -> FirTypeAliasSymbol Test0 + +@B() +owner -> FirTypeAliasSymbol Test0 +context -> FirTypeAliasSymbol Test0 + +@A() +owner -> FirTypeAliasSymbol Test1 +context -> FirTypeAliasSymbol Test1 + +@A() +owner -> FirTypeAliasSymbol Test1 +context -> FirTypeAliasSymbol Test1 + +@A() +owner -> FirTypeAliasSymbol Test2 +context -> FirTypeAliasSymbol Test2 + +@B() +owner -> FirTypeAliasSymbol Test2 +context -> FirTypeAliasSymbol Test2 + +@A() +owner -> FirTypeAliasSymbol Test3 +context -> FirTypeAliasSymbol Test3 + +@A() +owner -> FirTypeAliasSymbol Test3 +context -> FirTypeAliasSymbol Test3 + +@A() +owner -> FirTypeAliasSymbol Test4 +context -> FirTypeAliasSymbol Test4 + +@B() +owner -> FirTypeAliasSymbol Test4 +context -> FirTypeAliasSymbol Test4 + +@A() +owner -> FirTypeAliasSymbol Test5 +context -> FirTypeAliasSymbol Test5 + +@B() +owner -> FirTypeAliasSymbol Test5 +context -> FirTypeAliasSymbol Test5 + +@A() +owner -> FirTypeAliasSymbol Test6 +context -> FirTypeAliasSymbol Test6 + +@B() +owner -> FirTypeAliasSymbol Test6 +context -> FirTypeAliasSymbol Test6 + +@A() +owner -> FirTypeAliasSymbol Test7 +context -> FirTypeAliasSymbol Test7 + +@B() +owner -> FirTypeAliasSymbol Test7 +context -> FirTypeAliasSymbol Test7 + +@A() +owner -> FirTypeAliasSymbol Test8 +context -> FirTypeAliasSymbol Test8 + +@B() +owner -> FirTypeAliasSymbol Test8 +context -> FirTypeAliasSymbol Test8 + +@A() +owner -> FirTypeAliasSymbol Test9 +context -> FirTypeAliasSymbol Test9 + +@B() +owner -> FirTypeAliasSymbol Test9 +context -> FirTypeAliasSymbol Test9 diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.annotationOwners.txt new file mode 100644 index 00000000000..2e81d493ff6 --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.annotationOwners.txt @@ -0,0 +1,31 @@ +@Target(AnnotationTarget#.EXPRESSION#, AnnotationTarget#.LOCAL_VARIABLE#) +owner -> FirRegularClassSymbol Ann +context -> FirRegularClassSymbol Ann + +@Retention(AnnotationRetention#.SOURCE#) +owner -> FirRegularClassSymbol Ann +context -> FirRegularClassSymbol Ann + +@Ann() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /foo + +@Ann() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /foo + +@Ann() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /foo + +@Ann() +owner -> FirNamedFunctionSymbol /foo +context -> FirNamedFunctionSymbol /foo + +@Ann() +owner -> FirNamedFunctionSymbol /bar +context -> FirPropertySymbol /x from FirNamedFunctionSymbol /bar + +@Ann() +owner -> FirNamedFunctionSymbol /bar +context -> FirPropertySymbol /y from FirNamedFunctionSymbol /bar diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/collectionLiterals.annotationOwners.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/collectionLiterals.annotationOwners.txt new file mode 100644 index 00000000000..647e7cc9cdd --- /dev/null +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/collectionLiterals.annotationOwners.txt @@ -0,0 +1,23 @@ +@Ann1(()) +owner -> FirRegularClassSymbol Zero +context -> FirRegularClassSymbol Zero + +@Ann2(()) +owner -> FirRegularClassSymbol Zero +context -> FirRegularClassSymbol Zero + +@Ann3(()) +owner -> FirRegularClassSymbol Zero +context -> FirRegularClassSymbol Zero + +@Ann1((IntegerLiteral(1), IntegerLiteral(2))) +owner -> FirRegularClassSymbol First +context -> FirRegularClassSymbol First + +@Ann2((Double(3.14))) +owner -> FirRegularClassSymbol Second +context -> FirRegularClassSymbol Second + +@Ann3((String(Alpha), String(Omega))) +owner -> FirRegularClassSymbol Third +context -> FirRegularClassSymbol Third diff --git a/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilderLazyBodiesTestCase.kt b/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilderLazyBodiesTestCase.kt index 92c7238576c..f5e6a1588b8 100644 --- a/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilderLazyBodiesTestCase.kt +++ b/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilderLazyBodiesTestCase.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -14,7 +14,7 @@ abstract class AbstractRawFirBuilderLazyBodiesTestCase : AbstractRawFirBuilderTe val file = createKtFile(filePath) val firFile = file.toFirFile(BodyBuildingMode.LAZY_BODIES) val firFileDump = FirRenderer().renderElementAsString(firFile) - val expectedPath = filePath.replace(".${myFileExt}", ".lazyBodies.txt") + val expectedPath = expectedPath(filePath, ".lazyBodies.txt") KotlinTestUtils.assertEqualsToFile(File(expectedPath), firFileDump) } } \ No newline at end of file diff --git a/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilderTestCase.kt b/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilderTestCase.kt index d3bcc37004b..d140b6c5543 100644 --- a/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilderTestCase.kt +++ b/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilderTestCase.kt @@ -12,19 +12,23 @@ import com.intellij.psi.tree.IElementType import com.intellij.util.PathUtil import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.fir.FirElement +import org.jetbrains.kotlin.fir.FirElementWithResolveState import org.jetbrains.kotlin.fir.FirFunctionTypeParameter import org.jetbrains.kotlin.fir.contracts.FirContractDescription import org.jetbrains.kotlin.fir.contracts.impl.FirEmptyContractDescription +import org.jetbrains.kotlin.fir.declarations.FirDeclaration import org.jetbrains.kotlin.fir.declarations.FirFile import org.jetbrains.kotlin.fir.declarations.FirTypeParameter import org.jetbrains.kotlin.fir.declarations.FirValueParameter import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl +import org.jetbrains.kotlin.fir.declarations.utils.isNonLocal import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.impl.FirContractCallBlock import org.jetbrains.kotlin.fir.references.impl.FirStubReference import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.renderer.FirRenderer import org.jetbrains.kotlin.fir.session.FirSessionFactoryHelper +import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionWithoutNameSymbol import org.jetbrains.kotlin.fir.types.FirTypeProjection import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.fir.types.isExtensionFunctionAnnotationCall @@ -38,6 +42,7 @@ import org.jetbrains.kotlin.psi.KtPsiFactory import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.testFramework.KtParsingTestCase import org.jetbrains.kotlin.test.util.KtTestUtil +import org.jetbrains.kotlin.utils.addToStdlib.joinToWithBuffer import java.io.File import kotlin.reflect.full.memberProperties import kotlin.reflect.jvm.isAccessible @@ -65,10 +70,100 @@ abstract class AbstractRawFirBuilderTestCase : KtParsingTestCase( val file = createKtFile(filePath) val firFile = file.toFirFile(BodyBuildingMode.NORMAL) val firFileDump = FirRenderer.withDeclarationAttributes().renderElementAsString(firFile) - val expectedPath = filePath.replace(".${myFileExt}", ".txt") + val expectedPath = expectedPath(filePath, ".txt") KotlinTestUtils.assertEqualsToFile(File(expectedPath), firFileDump) + checkAnnotationOwners(filePath, firFile) } + protected fun expectedPath(originalPath: String, newExtension: String): String { + return originalPath.replace(".${myFileExt}", newExtension) + } + + protected fun checkAnnotationOwners(filePath: String, firFile: FirFile) { + val expectedPath = expectedPath(filePath, ".annotationOwners.txt") + val expectedFile = File(expectedPath) + val annotations = firFile.collectAnnotations() + if (annotations.isEmpty() && !expectedFile.exists()) { + return + } + + val actual = annotations.groupBy(AnnotationWithContext::annotation) + .entries + .joinToString(separator = "\n\n") { (annotation, contexts) -> + buildString { + appendLine(annotation.render().trim()) + append("owner -> ") + appendLine(annotation.containingDeclarationSymbol) + + contexts.joinToWithBuffer(buffer = this, separator = "\n") { + append("context -> ") + append(it.context) + } + } + } + + KotlinTestUtils.assertEqualsToFile(expectedFile, actual) + } + + private fun FirElementWithResolveState.collectAnnotations(): Collection { + val result = mutableListOf() + val contextStack = ContextStack() + + this.accept(object : FirVisitorVoid() { + override fun visitElement(element: FirElement) { + contextStack.withStack(element) { + if (element is FirAnnotationCall) { + result += AnnotationWithContext(element, contextStack.dumpContext()) + } + + element.acceptChildren(this) + } + } + }) + + return result + } + + private class AnnotationWithContext(val annotation: FirAnnotationCall, val context: String) + + private class ContextStack { + val stack = mutableListOf() + + inline fun withStack(element: FirElement, action: () -> Unit) { + if (element !is FirDeclaration) { + action() + return + } + + stack += element + try { + action() + } finally { + val last = stack.removeLast() + if (last != element) { + error("Stack is corrupted") + } + } + } + + fun dumpContext(): String { + val reversedStack = stack.asReversed().iterator() + return buildString { + var declaration = reversedStack.next() + append(declaration.symbol) + + while (declaration.shouldAddParentContext() && reversedStack.hasNext()) { + declaration = reversedStack.next() + append(" from ") + append(declaration.symbol) + } + } + } + + private fun FirDeclaration.shouldAddParentContext(): Boolean = symbol is FirFunctionWithoutNameSymbol || !isNonLocal + } + + protected fun createKtFile(filePath: String): KtFile { myFileExt = FileUtilRt.getExtension(PathUtil.getFileName(filePath)) return (createFile(filePath, KtNodeTypes.KT_FILE) as KtFile).apply { diff --git a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilder.kt b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilder.kt index dc81b8ff667..b0aeb8b7d4d 100644 --- a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilder.kt +++ b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilder.kt @@ -26,6 +26,7 @@ import org.jetbrains.kotlin.fir.expressions.builder.* import org.jetbrains.kotlin.fir.references.builder.buildImplicitThisReference import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.references.builder.buildSimpleNamedReference +import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef @@ -144,6 +145,31 @@ abstract class AbstractRawFirBuilder(val baseSession: FirSession, val context } } + /** + * @param isLocal if true [symbol] will be ignored + * + * @see Context.containerSymbol + * @see Context.pushContainerSymbol + * @see Context.popContainerSymbol + */ + inline fun withContainerSymbol( + symbol: FirBasedSymbol<*>, + isLocal: Boolean = false, + block: () -> T, + ): T { + if (!isLocal) { + context.pushContainerSymbol(symbol) + } + + return try { + block() + } finally { + if (!isLocal) { + context.popContainerSymbol(symbol) + } + } + } + protected open fun addCapturedTypeParameters( status: Boolean, declarationSource: KtSourceElement?, diff --git a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/Context.kt b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/Context.kt index b425ced6efc..227b52bd766 100644 --- a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/Context.kt +++ b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/Context.kt @@ -11,13 +11,17 @@ import org.jetbrains.kotlin.fir.FirLoopTarget import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRef import org.jetbrains.kotlin.fir.declarations.builder.buildOuterClassTypeParameterRef import org.jetbrains.kotlin.fir.expressions.FirExpression +import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol import org.jetbrains.kotlin.fir.types.ConeClassLikeType +import org.jetbrains.kotlin.fir.utils.exceptions.withFirSymbolEntry import org.jetbrains.kotlin.name.CallableId import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.util.PrivateForInline +import org.jetbrains.kotlin.utils.exceptions.checkWithAttachment +import org.jetbrains.kotlin.utils.exceptions.requireWithAttachment class Context { lateinit var packageFqName: FqName @@ -78,6 +82,72 @@ class Context { } } + /** + * This property will be stored in [_containerSymbolStack] instead the next symbol. + * If the stack is already not empty, symbols that are added on top won't be replaced. + * The forced symbol will come into effect the next time the stack is empty. + * + * @see containerSymbol + * @see pushContainerSymbol + * @see popContainerSymbol + */ + @set:PrivateForInline + var forcedContainerSymbol: FirBasedSymbol<*>? = null + set(value) { + requireWithAttachment(field == null, { "The value cannot be reassigned" }) { + value?.let { withFirSymbolEntry("newValue", it) } + field?.let { withFirSymbolEntry("oldValue", it) } + } + + field = value + } + + /** + * This stack is required to provide correct + * [FirAnnotationCall.containingDeclarationSymbol][org.jetbrains.kotlin.fir.expressions.FirAnnotationCall.containingDeclarationSymbol] + * during annotation call creation. + * + * @see pushContainerSymbol + * @see popContainerSymbol + */ + val containerSymbol: FirBasedSymbol<*> get() = _containerSymbolStack.last() + private val _containerSymbolStack: MutableList> = mutableListOf>() + + /** + * Add [symbol] to the container symbols stack. Must be paired with [popContainerSymbol]. + * + * @see containerSymbol + */ + fun pushContainerSymbol(symbol: FirBasedSymbol<*>) { + /** + * Replace [symbol] with [forcedContainerSymbol] if it is the first invocation of [pushContainerSymbol] in the stack + */ + val containerSymbol = forcedContainerSymbol?.takeIf { _containerSymbolStack.isEmpty() } ?: symbol + _containerSymbolStack += containerSymbol + } + + /** + * Remove [symbol] from the container symbols stack. Must be called after corresponding [pushContainerSymbol]. + * + * @see containerSymbol + */ + fun popContainerSymbol(symbol: FirBasedSymbol<*>) { + /** + * The counterpart of [pushContainerSymbol] logic + */ + val removed = _containerSymbolStack.removeLast() + val containerSymbol = forcedContainerSymbol?.takeIf { _containerSymbolStack.isEmpty() } ?: symbol + checkWithAttachment(removed === containerSymbol, { "Inconsistent declaration stack" }) { + withFirSymbolEntry("expected", containerSymbol) + withFirSymbolEntry("actual", removed) + if (symbol != containerSymbol) { + withFirSymbolEntry("replaced symbol", symbol) + } + + withEntry("stack", _containerSymbolStack.asReversed().toString()) + } + } + /** * Gets the last label that was added or null if the current node does not have permission to use the label. */ diff --git a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/Destructuring.kt b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/Destructuring.kt index 07c8cd765de..dadbd7b6421 100644 --- a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/Destructuring.kt +++ b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/Destructuring.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.declarations.FirVariable import org.jetbrains.kotlin.fir.declarations.builder.buildProperty import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl import org.jetbrains.kotlin.fir.expressions.FirStatement +import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.name.Name @@ -22,10 +23,10 @@ interface DestructuringContext { val T.returnTypeRef: FirTypeRef val T.name: Name val T.source: KtSourceElement - fun T.extractAnnotationsTo(target: FirAnnotationContainerBuilder) + fun T.extractAnnotationsTo(target: FirAnnotationContainerBuilder, containerSymbol: FirBasedSymbol<*>) } -context(DestructuringContext) +context(AbstractRawFirBuilder<*>, DestructuringContext) fun MutableList.addDestructuringStatements( moduleData: FirModuleData, container: FirVariable, @@ -39,17 +40,19 @@ fun MutableList.addDestructuringStatements( } for ((index, entry) in entries.withIndex()) { this += buildProperty { - this.moduleData = moduleData - origin = FirDeclarationOrigin.Source - returnTypeRef = entry.returnTypeRef - name = entry.name - initializer = container.toComponentCall(entry.source, index) - this.isVar = isVar symbol = FirPropertySymbol(entry.name) - source = entry.source - isLocal = localEntries - status = FirDeclarationStatusImpl(if (localEntries) Visibilities.Local else Visibilities.Public, Modality.FINAL) - entry.extractAnnotationsTo(this) + withContainerSymbol(symbol, localEntries) { + this.moduleData = moduleData + origin = FirDeclarationOrigin.Source + returnTypeRef = entry.returnTypeRef + name = entry.name + initializer = container.toComponentCall(entry.source, index) + this.isVar = isVar + source = entry.source + isLocal = localEntries + status = FirDeclarationStatusImpl(if (localEntries) Visibilities.Local else Visibilities.Public, Modality.FINAL) + entry.extractAnnotationsTo(this, context.containerSymbol) + } } } } \ No newline at end of file diff --git a/plugins/kotlinx-serialization/kotlinx-serialization.k2/src/org/jetbrains/kotlinx/serialization/compiler/fir/SerializationFirUtils.kt b/plugins/kotlinx-serialization/kotlinx-serialization.k2/src/org/jetbrains/kotlinx/serialization/compiler/fir/SerializationFirUtils.kt index 09cdfb8b22b..0ed2b1c60c1 100644 --- a/plugins/kotlinx-serialization/kotlinx-serialization.k2/src/org/jetbrains/kotlinx/serialization/compiler/fir/SerializationFirUtils.kt +++ b/plugins/kotlinx-serialization/kotlinx-serialization.k2/src/org/jetbrains/kotlinx/serialization/compiler/fir/SerializationFirUtils.kt @@ -258,7 +258,7 @@ val ConeKotlinType.isAbstractOrSealedOrInterface: Boolean context(FirExtension) -fun FirAnnotationContainer.excludeFromJsExport() { +fun FirDeclaration.excludeFromJsExport() { if (!session.moduleData.platform.isJs()) { return } @@ -275,6 +275,8 @@ fun FirAnnotationContainer.excludeFromJsExport() { name = jsExportIgnoreAnnotation.name resolvedSymbol = jsExportIgnoreConstructor } + + containingDeclarationSymbol = this@excludeFromJsExport.symbol } replaceAnnotations(annotations + jsExportIgnoreAnnotationCall)