From 8bbe60e96c08a88394c036de5ef71c8e741a589c Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Thu, 15 Dec 2022 16:12:13 +0100 Subject: [PATCH] [AA] add more tests on companion members --- ...sSourceModuleSymbolByPsiTestGenerated.java | 12 + ...sSourceModuleSymbolByPsiTestGenerated.java | 12 + ...sSourceModuleSymbolByPsiTestGenerated.java | 12 + .../symbolByPsi/functionsFromCompanion.kt | 11 + .../functionsFromCompanion.pretty.txt | 8 + .../symbolByPsi/functionsFromCompanion.txt | 124 ++++ ...ertiesFromCompanion.descriptors.pretty.txt | 19 + .../propertiesFromCompanion.descriptors.txt | 606 +++++++++++++++++ .../symbolByPsi/propertiesFromCompanion.kt | 24 + .../propertiesFromCompanion.pretty.txt | 21 + .../symbolByPsi/propertiesFromCompanion.txt | 612 ++++++++++++++++++ 11 files changed, 1461 insertions(+) create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.kt create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.pretty.txt create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.txt create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.descriptors.pretty.txt create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.descriptors.txt create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.kt create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.pretty.txt create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.txt diff --git a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/symbols/Fe10IdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/symbols/Fe10IdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java index f0ded3b4b61..0cabddd0cc6 100644 --- a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/symbols/Fe10IdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java +++ b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/symbols/Fe10IdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java @@ -196,6 +196,12 @@ public class Fe10IdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated extends A runTest("analysis/analysis-api/testData/symbols/symbolByPsi/functionWithTypeParams.kt"); } + @Test + @TestMetadata("functionsFromCompanion.kt") + public void testFunctionsFromCompanion() throws Exception { + runTest("analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.kt"); + } + @Test @TestMetadata("implicitConstructorDelegationCall.kt") public void testImplicitConstructorDelegationCall() throws Exception { @@ -256,6 +262,12 @@ public class Fe10IdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated extends A runTest("analysis/analysis-api/testData/symbols/symbolByPsi/outerAndInnerTypeAlias.kt"); } + @Test + @TestMetadata("propertiesFromCompanion.kt") + public void testPropertiesFromCompanion() throws Exception { + runTest("analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.kt"); + } + @Test @TestMetadata("similarGenericSignature.kt") public void testSimilarGenericSignature() throws Exception { diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/symbols/FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/symbols/FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java index 2328157cc2d..d8c25fbf9c7 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/symbols/FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/symbols/FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java @@ -196,6 +196,12 @@ public class FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated extends Ab runTest("analysis/analysis-api/testData/symbols/symbolByPsi/functionWithTypeParams.kt"); } + @Test + @TestMetadata("functionsFromCompanion.kt") + public void testFunctionsFromCompanion() throws Exception { + runTest("analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.kt"); + } + @Test @TestMetadata("implicitConstructorDelegationCall.kt") public void testImplicitConstructorDelegationCall() throws Exception { @@ -256,6 +262,12 @@ public class FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated extends Ab runTest("analysis/analysis-api/testData/symbols/symbolByPsi/outerAndInnerTypeAlias.kt"); } + @Test + @TestMetadata("propertiesFromCompanion.kt") + public void testPropertiesFromCompanion() throws Exception { + runTest("analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.kt"); + } + @Test @TestMetadata("similarGenericSignature.kt") public void testSimilarGenericSignature() throws Exception { diff --git a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/symbols/FirStandaloneNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/symbols/FirStandaloneNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java index b175dc2fcc8..193c769e3c3 100644 --- a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/symbols/FirStandaloneNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java +++ b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/symbols/FirStandaloneNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java @@ -196,6 +196,12 @@ public class FirStandaloneNormalAnalysisSourceModuleSymbolByPsiTestGenerated ext runTest("analysis/analysis-api/testData/symbols/symbolByPsi/functionWithTypeParams.kt"); } + @Test + @TestMetadata("functionsFromCompanion.kt") + public void testFunctionsFromCompanion() throws Exception { + runTest("analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.kt"); + } + @Test @TestMetadata("implicitConstructorDelegationCall.kt") public void testImplicitConstructorDelegationCall() throws Exception { @@ -256,6 +262,12 @@ public class FirStandaloneNormalAnalysisSourceModuleSymbolByPsiTestGenerated ext runTest("analysis/analysis-api/testData/symbols/symbolByPsi/outerAndInnerTypeAlias.kt"); } + @Test + @TestMetadata("propertiesFromCompanion.kt") + public void testPropertiesFromCompanion() throws Exception { + runTest("analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.kt"); + } + @Test @TestMetadata("similarGenericSignature.kt") public void testSimilarGenericSignature() throws Exception { diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.kt b/analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.kt new file mode 100644 index 00000000000..cf5a25870ce --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.kt @@ -0,0 +1,11 @@ +// WITH_STDLIB +// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1 + +class MyClass { + companion object { + fun functionFromCompanion(i: Int) = Unit + + @JvmStatic + fun staticFunctionFromCompanion() = 4 + } +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.pretty.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.pretty.txt new file mode 100644 index 00000000000..56cac03a5a9 --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.pretty.txt @@ -0,0 +1,8 @@ +class MyClass { + companion object { + fun functionFromCompanion(i: kotlin.Int) + + @kotlin.jvm.JvmStatic + fun staticFunctionFromCompanion(): kotlin.Int + } +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.txt new file mode 100644 index 00000000000..cc7819d8d35 --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/functionsFromCompanion.txt @@ -0,0 +1,124 @@ +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: /MyClass.Companion.functionFromCompanion + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: functionFromCompanion + origin: SOURCE + receiverParameter: null + returnType: kotlin/Unit + 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: i + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + ] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtFunctionSymbol: + annotationsList: [ + kotlin/jvm/JvmStatic() + psi: KtAnnotationEntry + ] + callableIdIfNonLocal: /MyClass.Companion.staticFunctionFromCompanion + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: staticFunctionFromCompanion + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: MyClass.Companion + classKind: COMPANION_OBJECT + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Companion + origin: SOURCE + superTypes: [ + kotlin/Any + ] + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: MyClass + classKind: CLASS + companionObject: KtNamedClassOrObjectSymbol(MyClass.Companion) + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: MyClass + origin: SOURCE + superTypes: [ + kotlin/Any + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.descriptors.pretty.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.descriptors.pretty.txt new file mode 100644 index 00000000000..57bdd13f94d --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.descriptors.pretty.txt @@ -0,0 +1,19 @@ +class MyClass { + companion object { + val property: kotlin.Int + + const val constProperty: kotlin.Int + + @kotlin.jvm.JvmStatic + val staticProperty: kotlin.Int + + val fieldProperty: kotlin.Int + + var variable: kotlin.Int + + @kotlin.jvm.JvmStatic + var staticVariable: kotlin.Int + + var fieldVariable: kotlin.Int + } +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.descriptors.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.descriptors.txt new file mode 100644 index 00000000000..ba243fd9820 --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.descriptors.txt @@ -0,0 +1,606 @@ +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /MyClass.Companion.property + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtConstantInitializerValue(0) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: property + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getProperty + javaSetterName: null + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /MyClass.Companion.constProperty + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtConstantInitializerValue(1) + isConst: true + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: constProperty + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getConstProperty + javaSetterName: null + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [ + kotlin/jvm/JvmStatic() + psi: KtAnnotationEntry + ] + callableIdIfNonLocal: /MyClass.Companion.staticProperty + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtConstantInitializerValue(2) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: staticProperty + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getStaticProperty + javaSetterName: null + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /MyClass.Companion.fieldProperty + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtConstantInitializerValue(3) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: fieldProperty + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: fieldProperty + javaSetterName: null + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /MyClass.Companion.variable + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: true + initializer: KtConstantInitializerValue(4) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: FINAL + name: variable + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: KtPropertySetterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasBody: false + hasStableParameterNames: true + isDefault: true + isExtension: false + isInline: false + isOverride: false + modality: FINAL + origin: SOURCE + parameter: KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: value + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + receiverParameter: null + returnType: kotlin/Unit + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: value + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + ] + visibility: Public + getContainingModule: Could not render due to kotlin.NotImplementedError: An operation is not implemented: org.jetbrains.kotlin.analysis.api.descriptors.symbols.psiBased.KtFe10PsiDefaultPropertySetterSymbol + + deprecationStatus: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getVariable + javaSetterName: setVariable + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [ + kotlin/jvm/JvmStatic() + psi: KtAnnotationEntry + ] + callableIdIfNonLocal: /MyClass.Companion.staticVariable + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: true + initializer: KtConstantInitializerValue(5) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: FINAL + name: staticVariable + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: KtPropertySetterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasBody: false + hasStableParameterNames: true + isDefault: true + isExtension: false + isInline: false + isOverride: false + modality: FINAL + origin: SOURCE + parameter: KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: value + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + receiverParameter: null + returnType: kotlin/Unit + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: value + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + ] + visibility: Public + getContainingModule: Could not render due to kotlin.NotImplementedError: An operation is not implemented: org.jetbrains.kotlin.analysis.api.descriptors.symbols.psiBased.KtFe10PsiDefaultPropertySetterSymbol + + deprecationStatus: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getStaticVariable + javaSetterName: setStaticVariable + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /MyClass.Companion.fieldVariable + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: true + initializer: KtConstantInitializerValue(0) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: FINAL + name: fieldVariable + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: KtPropertySetterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasBody: false + hasStableParameterNames: true + isDefault: true + isExtension: false + isInline: false + isOverride: false + modality: FINAL + origin: SOURCE + parameter: KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: value + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + receiverParameter: null + returnType: kotlin/Unit + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: value + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + ] + visibility: Public + getContainingModule: Could not render due to kotlin.NotImplementedError: An operation is not implemented: org.jetbrains.kotlin.analysis.api.descriptors.symbols.psiBased.KtFe10PsiDefaultPropertySetterSymbol + + deprecationStatus: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: fieldVariable + javaSetterName: fieldVariable + setterDeprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: MyClass.Companion + classKind: COMPANION_OBJECT + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Companion + origin: SOURCE + superTypes: [ + kotlin/Any + ] + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: MyClass + classKind: CLASS + companionObject: KtNamedClassOrObjectSymbol(MyClass.Companion) + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: MyClass + origin: SOURCE + superTypes: [ + kotlin/Any + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.kt b/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.kt new file mode 100644 index 00000000000..3cbdffb596f --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.kt @@ -0,0 +1,24 @@ +// WITH_STDLIB +// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1 + +class MyClass { + companion object { + val property = 0 + + const val constProperty = 1 + + @JvmStatic + val staticProperty = 2 + + @JvmField + val fieldProperty = 3 + + var variable = 4 + + @JvmStatic + var staticVariable = 5 + + @JvmField + var fieldVariable = 0 + } +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.pretty.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.pretty.txt new file mode 100644 index 00000000000..c3ed27a8590 --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.pretty.txt @@ -0,0 +1,21 @@ +class MyClass { + companion object { + val property: kotlin.Int + + const val constProperty: kotlin.Int + + @kotlin.jvm.JvmStatic + val staticProperty: kotlin.Int + + @kotlin.jvm.JvmField + val fieldProperty: kotlin.Int + + var variable: kotlin.Int + + @kotlin.jvm.JvmStatic + var staticVariable: kotlin.Int + + @kotlin.jvm.JvmField + var fieldVariable: kotlin.Int + } +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.txt new file mode 100644 index 00000000000..805a07de89a --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/propertiesFromCompanion.txt @@ -0,0 +1,612 @@ +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /MyClass.Companion.property + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtConstantInitializerValue(0) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: property + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getProperty + javaSetterName: null + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /MyClass.Companion.constProperty + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtConstantInitializerValue(1) + isConst: true + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: constProperty + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getConstProperty + javaSetterName: null + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [ + kotlin/jvm/JvmStatic() + psi: KtAnnotationEntry + ] + callableIdIfNonLocal: /MyClass.Companion.staticProperty + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtConstantInitializerValue(2) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: staticProperty + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getStaticProperty + javaSetterName: null + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [ + kotlin/jvm/JvmField() + psi: KtAnnotationEntry + ] + callableIdIfNonLocal: /MyClass.Companion.fieldProperty + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtConstantInitializerValue(3) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: fieldProperty + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: fieldProperty + javaSetterName: null + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /MyClass.Companion.variable + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: true + initializer: KtConstantInitializerValue(4) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: FINAL + name: variable + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: KtPropertySetterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasBody: false + hasStableParameterNames: true + isDefault: true + isExtension: false + isInline: false + isOverride: false + modality: FINAL + origin: SOURCE + parameter: KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: value + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + receiverParameter: null + returnType: kotlin/Unit + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: value + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + ] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getVariable + javaSetterName: setVariable + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [ + kotlin/jvm/JvmStatic() + psi: KtAnnotationEntry + ] + callableIdIfNonLocal: /MyClass.Companion.staticVariable + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: true + initializer: KtConstantInitializerValue(5) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: FINAL + name: staticVariable + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: KtPropertySetterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasBody: false + hasStableParameterNames: true + isDefault: true + isExtension: false + isInline: false + isOverride: false + modality: FINAL + origin: SOURCE + parameter: KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: value + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + receiverParameter: null + returnType: kotlin/Unit + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: value + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + ] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getStaticVariable + javaSetterName: setStaticVariable + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [ + kotlin/jvm/JvmField() + psi: KtAnnotationEntry + ] + callableIdIfNonLocal: /MyClass.Companion.fieldVariable + 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: kotlin/Int + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + hasBackingField: true + hasGetter: true + hasSetter: true + initializer: KtConstantInitializerValue(0) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: FINAL + name: fieldVariable + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + setter: KtPropertySetterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasBody: false + hasStableParameterNames: true + isDefault: true + isExtension: false + isInline: false + isOverride: false + modality: FINAL + origin: SOURCE + parameter: KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: value + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + receiverParameter: null + returnType: kotlin/Unit + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: false + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: value + origin: SOURCE + receiverParameter: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + ] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): MyClass.Companion + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: fieldVariable + javaSetterName: fieldVariable + setterDeprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: MyClass.Companion + classKind: COMPANION_OBJECT + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Companion + origin: SOURCE + superTypes: [ + kotlin/Any + ] + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: MyClass + classKind: CLASS + companionObject: KtNamedClassOrObjectSymbol(MyClass.Companion) + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: MyClass + origin: SOURCE + superTypes: [ + kotlin/Any + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null \ No newline at end of file