From 3aefeb0fc58bbf0251182ff32ba4127c9376b8f9 Mon Sep 17 00:00:00 2001 From: Marco Pennekamp Date: Thu, 24 Aug 2023 22:00:04 +0200 Subject: [PATCH] [AA] Add tests for enum entry initializer member scopes ^KT-61425 --- ...oduleMemberScopeByFqNameTestGenerated.java | 18 +- ...oduleMemberScopeByFqNameTestGenerated.java | 18 +- .../{enumEntry.kt => enumEntryInitializer.kt} | 2 +- .../enumEntryInitializer.pretty.txt | 24 + ...enumEntry.txt => enumEntryInitializer.txt} | 52 ++ ...enumEntryInitializerWithFinalEnumMember.kt | 12 + ...yInitializerWithFinalEnumMember.pretty.txt | 26 + ...numEntryInitializerWithFinalEnumMember.txt | 667 ++++++++++++++++++ ...numEntryInitializerWithOverriddenMember.kt | 12 + ...InitializerWithOverriddenMember.pretty.txt | 24 + ...umEntryInitializerWithOverriddenMember.txt | 582 +++++++++++++++ 11 files changed, 1430 insertions(+), 7 deletions(-) rename analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/{enumEntry.kt => enumEntryInitializer.kt} (76%) create mode 100644 analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializer.pretty.txt rename analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/{enumEntry.txt => enumEntryInitializer.txt} (91%) create mode 100644 analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.kt create mode 100644 analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.pretty.txt create mode 100644 analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.txt create mode 100644 analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.kt create mode 100644 analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.pretty.txt create mode 100644 analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.txt diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeNormalAnalysisSourceModuleMemberScopeByFqNameTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeNormalAnalysisSourceModuleMemberScopeByFqNameTestGenerated.java index f6a1dbe1797..a430a954680 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeNormalAnalysisSourceModuleMemberScopeByFqNameTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeNormalAnalysisSourceModuleMemberScopeByFqNameTestGenerated.java @@ -53,9 +53,21 @@ public class FirIdeNormalAnalysisSourceModuleMemberScopeByFqNameTestGenerated ex } @Test - @TestMetadata("enumEntry.kt") - public void testEnumEntry() throws Exception { - runTest("analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntry.kt"); + @TestMetadata("enumEntryInitializer.kt") + public void testEnumEntryInitializer() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializer.kt"); + } + + @Test + @TestMetadata("enumEntryInitializerWithFinalEnumMember.kt") + public void testEnumEntryInitializerWithFinalEnumMember() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.kt"); + } + + @Test + @TestMetadata("enumEntryInitializerWithOverriddenMember.kt") + public void testEnumEntryInitializerWithOverriddenMember() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.kt"); } @Test diff --git a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/scopeProvider/FirStandaloneNormalAnalysisSourceModuleMemberScopeByFqNameTestGenerated.java b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/scopeProvider/FirStandaloneNormalAnalysisSourceModuleMemberScopeByFqNameTestGenerated.java index 90eba8bc9e2..7cb5539563a 100644 --- a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/scopeProvider/FirStandaloneNormalAnalysisSourceModuleMemberScopeByFqNameTestGenerated.java +++ b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/scopeProvider/FirStandaloneNormalAnalysisSourceModuleMemberScopeByFqNameTestGenerated.java @@ -53,9 +53,21 @@ public class FirStandaloneNormalAnalysisSourceModuleMemberScopeByFqNameTestGener } @Test - @TestMetadata("enumEntry.kt") - public void testEnumEntry() throws Exception { - runTest("analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntry.kt"); + @TestMetadata("enumEntryInitializer.kt") + public void testEnumEntryInitializer() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializer.kt"); + } + + @Test + @TestMetadata("enumEntryInitializerWithFinalEnumMember.kt") + public void testEnumEntryInitializerWithFinalEnumMember() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.kt"); + } + + @Test + @TestMetadata("enumEntryInitializerWithOverriddenMember.kt") + public void testEnumEntryInitializerWithOverriddenMember() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.kt"); } @Test diff --git a/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntry.kt b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializer.kt similarity index 76% rename from analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntry.kt rename to analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializer.kt index 3989e0c7156..e9c9e39de8e 100644 --- a/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntry.kt +++ b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializer.kt @@ -7,4 +7,4 @@ enum class E { } } -// callable: test/E.A +// enum_entry_initializer: test/E.A diff --git a/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializer.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializer.pretty.txt new file mode 100644 index 00000000000..d731c2b40d3 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializer.pretty.txt @@ -0,0 +1,24 @@ +val x: kotlin.String + +protected fun clone(): kotlin.Any + +operator fun compareTo(other: test.E): kotlin.Int + +operator fun equals(other: kotlin.Any?): kotlin.Boolean + +fun hashCode(): kotlin.Int + +open fun toString(): kotlin.String + +@kotlin.internal.IntrinsicConstEvaluation +val name: kotlin.String + +val ordinal: kotlin.Int + +fun getDeclaringClass(): (java.lang.Class..java.lang.Class?) + +fun finalize() + +companion object + +private constructor() \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntry.txt b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializer.txt similarity index 91% rename from analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntry.txt rename to analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializer.txt index 54f0bfada62..9b59ca977d0 100644 --- a/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntry.txt +++ b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializer.txt @@ -527,4 +527,56 @@ KtFunctionSymbol: ] type: kotlin/Enum getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: kotlin/Enum.Companion + classKind: COMPANION_OBJECT + companionObject: null + contextReceivers: [] + isActual: false + isData: false + isExpect: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Companion + origin: LIBRARY + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + annotationApplicableTargets: null + deprecationStatus: null + +KtConstructorSymbol: + annotationsList: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: null + contextReceivers: [] + hasStableParameterNames: true + isActual: false + isExpect: false + isExtension: false + isPrimary: true + origin: SOURCE_MEMBER_GENERATED + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Private + getContainingModule: KtSourceModule "Sources of main" deprecationStatus: null \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.kt b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.kt new file mode 100644 index 00000000000..45ab1aeb37f --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.kt @@ -0,0 +1,12 @@ +// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1 +package test + +enum class E { + A { + val x: String = "" + }; + + val foo: Int = 5 +} + +// enum_entry_initializer: test/E.A diff --git a/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.pretty.txt new file mode 100644 index 00000000000..d5a738ec234 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.pretty.txt @@ -0,0 +1,26 @@ +val x: kotlin.String + +val foo: kotlin.Int + +protected fun clone(): kotlin.Any + +operator fun compareTo(other: test.E): kotlin.Int + +operator fun equals(other: kotlin.Any?): kotlin.Boolean + +fun hashCode(): kotlin.Int + +open fun toString(): kotlin.String + +@kotlin.internal.IntrinsicConstEvaluation +val name: kotlin.String + +val ordinal: kotlin.Int + +fun getDeclaringClass(): (java.lang.Class..java.lang.Class?) + +fun finalize() + +companion object + +private constructor() \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.txt b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.txt new file mode 100644 index 00000000000..83e3f727e7a --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithFinalEnumMember.txt @@ -0,0 +1,667 @@ +KtKotlinPropertySymbol: + annotationsList: [] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(/x) + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/String + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + callableIdIfNonLocal: null + contextReceivers: [] + getter: KtPropertyGetterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasBody: false + hasStableParameterNames: true + isDefault: true + isExtension: false + isInline: false + isOverride: false + modality: FINAL + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/String + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtConstantInitializerValue("") + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: x + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/String + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getX + javaSetterName: null + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(test/E.foo) + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + callableIdIfNonLocal: test/E.foo + contextReceivers: [] + getter: KtPropertyGetterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasBody: false + hasStableParameterNames: true + isDefault: true + isExtension: false + isInline: false + isOverride: false + modality: FINAL + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: test/E + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtConstantInitializerValue(5) + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: foo + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: test/E + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getFoo + javaSetterName: null + setterDeprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Enum.clone + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: clone + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Protected + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: test/E.compareTo + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: compareTo + origin: SUBSTITUTION_OVERRIDE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: other + origin: SUBSTITUTION_OVERRIDE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: test/E + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + ] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: test/E + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Enum.equals + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: equals + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: other + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any? + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + ] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Enum.hashCode + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: hashCode + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Enum.toString + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: OPEN + name: toString + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/String + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [ + kotlin/internal/IntrinsicConstEvaluation() + psi: null + ] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(kotlin/Enum.name) + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/String + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + callableIdIfNonLocal: kotlin/Enum.name + contextReceivers: [] + getter: null + hasBackingField: true + hasGetter: false + hasSetter: false + initializer: null + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: name + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/String + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getName + javaSetterName: null + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(kotlin/Enum.ordinal) + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + callableIdIfNonLocal: kotlin/Enum.ordinal + contextReceivers: [] + getter: null + hasBackingField: true + hasGetter: false + hasSetter: false + initializer: null + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: ordinal + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getOrdinal + javaSetterName: null + setterDeprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: test/E.getDeclaringClass + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: false + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: getDeclaringClass + origin: SUBSTITUTION_OVERRIDE + receiverParameter: null + returnType: KtFlexibleType: + annotationsList: [] + type: ft, java/lang/Class?> + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: test/E + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Enum.finalize + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: false + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: finalize + origin: JAVA + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Unit + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: ProtectedAndPackage + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: kotlin/Enum.Companion + classKind: COMPANION_OBJECT + companionObject: null + contextReceivers: [] + isActual: false + isData: false + isExpect: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Companion + origin: LIBRARY + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + annotationApplicableTargets: null + deprecationStatus: null + +KtConstructorSymbol: + annotationsList: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: null + contextReceivers: [] + hasStableParameterNames: true + isActual: false + isExpect: false + isExtension: false + isPrimary: true + origin: SOURCE_MEMBER_GENERATED + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Private + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.kt b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.kt new file mode 100644 index 00000000000..c42f477e227 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.kt @@ -0,0 +1,12 @@ +// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1 +package test + +enum class E { + A { + override val foo: Int = 65 + }; + + abstract val foo: Int? +} + +// enum_entry_initializer: test/E.A diff --git a/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.pretty.txt new file mode 100644 index 00000000000..97e673a285c --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.pretty.txt @@ -0,0 +1,24 @@ +override val foo: kotlin.Int + +protected fun clone(): kotlin.Any + +operator fun compareTo(other: test.E): kotlin.Int + +operator fun equals(other: kotlin.Any?): kotlin.Boolean + +fun hashCode(): kotlin.Int + +open fun toString(): kotlin.String + +@kotlin.internal.IntrinsicConstEvaluation +val name: kotlin.String + +val ordinal: kotlin.Int + +fun getDeclaringClass(): (java.lang.Class..java.lang.Class?) + +fun finalize() + +companion object + +private constructor() \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.txt b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.txt new file mode 100644 index 00000000000..21a150045c1 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/memberScopeByFqName/enumEntryInitializerWithOverriddenMember.txt @@ -0,0 +1,582 @@ +KtKotlinPropertySymbol: + annotationsList: [] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(/foo) + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + callableIdIfNonLocal: null + contextReceivers: [] + getter: KtPropertyGetterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasBody: false + hasStableParameterNames: true + isDefault: true + isExtension: false + isInline: false + isOverride: true + modality: FINAL + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtConstantInitializerValue(65) + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: true + isStatic: false + isVal: true + modality: OPEN + name: foo + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getFoo + javaSetterName: null + setterDeprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Enum.clone + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: clone + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Protected + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: test/E.compareTo + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: compareTo + origin: SUBSTITUTION_OVERRIDE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: other + origin: SUBSTITUTION_OVERRIDE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: test/E + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + ] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: test/E + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Enum.equals + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: equals + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Boolean + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: other + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any? + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + ] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Enum.hashCode + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: hashCode + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Enum.toString + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: OPEN + name: toString + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/String + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [ + kotlin/internal/IntrinsicConstEvaluation() + psi: null + ] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(kotlin/Enum.name) + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/String + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + callableIdIfNonLocal: kotlin/Enum.name + contextReceivers: [] + getter: null + hasBackingField: true + hasGetter: false + hasSetter: false + initializer: null + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: name + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/String + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getName + javaSetterName: null + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(kotlin/Enum.ordinal) + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + callableIdIfNonLocal: kotlin/Enum.ordinal + contextReceivers: [] + getter: null + hasBackingField: true + hasGetter: false + hasSetter: false + initializer: null + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: ordinal + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getOrdinal + javaSetterName: null + setterDeprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: test/E.getDeclaringClass + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: false + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: getDeclaringClass + origin: SUBSTITUTION_OVERRIDE + receiverParameter: null + returnType: KtFlexibleType: + annotationsList: [] + type: ft, java/lang/Class?> + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: test/E + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Enum.finalize + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: false + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: finalize + origin: JAVA + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Unit + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: ProtectedAndPackage + getDispatchReceiver(): KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: E + ] + type: kotlin/Enum + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: kotlin/Enum.Companion + classKind: COMPANION_OBJECT + companionObject: null + contextReceivers: [] + isActual: false + isData: false + isExpect: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Companion + origin: LIBRARY + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" + annotationApplicableTargets: null + deprecationStatus: null + +KtConstructorSymbol: + annotationsList: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: null + contextReceivers: [] + hasStableParameterNames: true + isActual: false + isExpect: false + isExtension: false + isPrimary: true + origin: SOURCE_MEMBER_GENERATED + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Private + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null \ No newline at end of file