From 317408e780712fbdb6e048b51fa1afd3f4c17297 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Fri, 7 Oct 2022 10:51:19 +0200 Subject: [PATCH] [AA] update tests on delegated property ^KT-54311 --- ...oduleDelegateMemberScopeTestGenerated.java | 6 + ...oduleDelegateMemberScopeTestGenerated.java | 6 + ...oduleDelegateMemberScopeTestGenerated.java | 6 + .../propertyWithGetter.descriptors.txt | 33 +++ .../propertyWithGetter.kt | 12 ++ .../propertyWithGetter.pretty.txt | 1 + .../propertyWithGetter.txt | 33 +++ .../simple.descriptors.pretty.txt | 11 + .../simple.descriptors.txt | 189 ++++++++++++++++++ .../scopes/delegatedMemberScope/simple.kt | 5 + .../delegatedMemberScope/simple.pretty.txt | 12 +- .../scopes/delegatedMemberScope/simple.txt | 165 ++++++++++++++- 12 files changed, 477 insertions(+), 2 deletions(-) create mode 100644 analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.descriptors.txt create mode 100644 analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.kt create mode 100644 analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.pretty.txt create mode 100644 analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.txt create mode 100644 analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.descriptors.pretty.txt create mode 100644 analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.descriptors.txt diff --git a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/scopes/Fe10IdeNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated.java b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/scopes/Fe10IdeNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated.java index 7443d57610b..cffe3e915d2 100644 --- a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/scopes/Fe10IdeNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated.java +++ b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/scopes/Fe10IdeNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated.java @@ -46,6 +46,12 @@ public class Fe10IdeNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated e KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/scopes/delegatedMemberScope"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test + @TestMetadata("propertyWithGetter.kt") + public void testPropertyWithGetter() throws Exception { + runTest("analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.kt"); + } + @Test @TestMetadata("simple.kt") public void testSimple() throws Exception { diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/scopes/FirIdeNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/scopes/FirIdeNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated.java index 1e625168490..3126786c41c 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/scopes/FirIdeNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/scopes/FirIdeNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated.java @@ -46,6 +46,12 @@ public class FirIdeNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated ex KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/scopes/delegatedMemberScope"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test + @TestMetadata("propertyWithGetter.kt") + public void testPropertyWithGetter() throws Exception { + runTest("analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.kt"); + } + @Test @TestMetadata("simple.kt") public void testSimple() throws Exception { diff --git a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/scopes/FirStandaloneNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated.java b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/scopes/FirStandaloneNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated.java index 4781ff5021d..e95523d6719 100644 --- a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/scopes/FirStandaloneNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated.java +++ b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/scopes/FirStandaloneNormalAnalysisSourceModuleDelegateMemberScopeTestGenerated.java @@ -46,6 +46,12 @@ public class FirStandaloneNormalAnalysisSourceModuleDelegateMemberScopeTestGener KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/scopes/delegatedMemberScope"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test + @TestMetadata("propertyWithGetter.kt") + public void testPropertyWithGetter() throws Exception { + runTest("analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.kt"); + } + @Test @TestMetadata("simple.kt") public void testSimple() throws Exception { diff --git a/analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.descriptors.txt b/analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.descriptors.txt new file mode 100644 index 00000000000..fd3eded0718 --- /dev/null +++ b/analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.descriptors.txt @@ -0,0 +1,33 @@ +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /I.foo + contextReceivers: [] + getter: KtPropertyGetterSymbol() + hasBackingField: false + hasGetter: true + hasSetter: false + initializer: null + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: OPEN + name: foo + origin: DELEGATED + receiverType: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getFoo + javaSetterName: null + setterDeprecationStatus: null \ No newline at end of file diff --git a/analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.kt b/analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.kt new file mode 100644 index 00000000000..583b17b318d --- /dev/null +++ b/analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.kt @@ -0,0 +1,12 @@ +// DO_NOT_CHECK_SYMBOL_RESTORE_K1 + +interface I { + val foo: Int get() = 2 +} + +class A( + private val p: I +) : I by p + +// class: A + diff --git a/analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.pretty.txt b/analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.pretty.txt new file mode 100644 index 00000000000..2015de5e807 --- /dev/null +++ b/analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.pretty.txt @@ -0,0 +1 @@ +open val foo: kotlin.Int \ No newline at end of file diff --git a/analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.txt b/analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.txt new file mode 100644 index 00000000000..7b55a1e7be3 --- /dev/null +++ b/analysis/analysis-api/testData/scopes/delegatedMemberScope/propertyWithGetter.txt @@ -0,0 +1,33 @@ +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /I.foo + contextReceivers: [] + getter: null + hasBackingField: false + hasGetter: false + hasSetter: false + initializer: null + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: OPEN + name: foo + origin: DELEGATED + receiverType: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getFoo + javaSetterName: null + setterDeprecationStatus: null \ No newline at end of file diff --git a/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.descriptors.pretty.txt b/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.descriptors.pretty.txt new file mode 100644 index 00000000000..580f6ae1852 --- /dev/null +++ b/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.descriptors.pretty.txt @@ -0,0 +1,11 @@ +open var kotlin.Int.zoo: kotlin.Unit + +open fun foo() + +open fun kotlin.Int.smth(): kotlin.Short + +open val foo: kotlin.Int + +open var bar: kotlin.Long + +open val kotlin.Int.doo: kotlin.String \ No newline at end of file diff --git a/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.descriptors.txt b/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.descriptors.txt new file mode 100644 index 00000000000..96e70650591 --- /dev/null +++ b/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.descriptors.txt @@ -0,0 +1,189 @@ +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /I.zoo + contextReceivers: [] + getter: KtPropertyGetterSymbol() + hasBackingField: false + hasGetter: true + hasSetter: true + initializer: null + isConst: false + isDelegatedProperty: false + isExtension: true + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: OPEN + name: zoo + origin: DELEGATED + receiverType: kotlin/Int + returnType: kotlin/Unit + setter: KtPropertySetterSymbol() + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getZoo + javaSetterName: setZoo + setterDeprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: /I.foo + contextReceivers: [] + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: OPEN + name: foo + origin: DELEGATED + receiverType: null + returnType: kotlin/Unit + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: /I.smth + contextReceivers: [] + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: true + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: OPEN + name: smth + origin: DELEGATED + receiverType: kotlin/Int + returnType: kotlin/Short + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /I.foo + contextReceivers: [] + getter: KtPropertyGetterSymbol() + hasBackingField: false + hasGetter: true + hasSetter: false + initializer: null + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: OPEN + name: foo + origin: DELEGATED + receiverType: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getFoo + javaSetterName: null + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /I.bar + contextReceivers: [] + getter: KtPropertyGetterSymbol() + hasBackingField: false + hasGetter: true + hasSetter: true + initializer: null + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: OPEN + name: bar + origin: DELEGATED + receiverType: null + returnType: kotlin/Long + setter: KtPropertySetterSymbol() + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getBar + javaSetterName: setBar + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /I.doo + contextReceivers: [] + getter: KtPropertyGetterSymbol() + hasBackingField: false + hasGetter: true + hasSetter: false + initializer: null + isConst: false + isDelegatedProperty: false + isExtension: true + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: OPEN + name: doo + origin: DELEGATED + receiverType: kotlin/Int + returnType: kotlin/String + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getDoo + javaSetterName: null + setterDeprecationStatus: null \ No newline at end of file diff --git a/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.kt b/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.kt index 5796f26924e..9f3417ef63f 100644 --- a/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.kt +++ b/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.kt @@ -1,7 +1,12 @@ // DO_NOT_CHECK_SYMBOL_RESTORE_K1 interface I { + var Int.zoo: Unit fun foo() + fun Int.smth(): Short + val foo: Int + var bar: Long + val Int.doo: String } class A( diff --git a/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.pretty.txt b/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.pretty.txt index 00bb9b9a886..75cf06b59bf 100644 --- a/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.pretty.txt +++ b/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.pretty.txt @@ -1 +1,11 @@ -open fun foo() \ No newline at end of file +open var kotlin.Int.zoo: kotlin.Unit + +open fun foo() + +open val foo: kotlin.Int + +open fun kotlin.Int.smth(): kotlin.Short + +open var bar: kotlin.Long + +open val kotlin.Int.doo: kotlin.String \ No newline at end of file diff --git a/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.txt b/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.txt index f36fd6455f1..7a62ca55a83 100644 --- a/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.txt +++ b/analysis/analysis-api/testData/scopes/delegatedMemberScope/simple.txt @@ -1,3 +1,37 @@ +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /I.zoo + contextReceivers: [] + getter: null + hasBackingField: false + hasGetter: false + hasSetter: false + initializer: null + isConst: false + isDelegatedProperty: false + isExtension: true + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: OPEN + name: zoo + origin: DELEGATED + receiverType: kotlin/Int + returnType: kotlin/Unit + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getZoo + javaSetterName: setZoo + setterDeprecationStatus: null + KtFunctionSymbol: annotationsList: [] callableIdIfNonLocal: /I.foo @@ -23,4 +57,133 @@ KtFunctionSymbol: visibility: Public getDispatchReceiver(): A getContainingModule: KtSourceModule "Sources of main" - deprecationStatus: null \ No newline at end of file + deprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /I.foo + contextReceivers: [] + getter: null + hasBackingField: false + hasGetter: false + hasSetter: false + initializer: null + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: OPEN + name: foo + origin: DELEGATED + receiverType: null + returnType: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getFoo + javaSetterName: null + setterDeprecationStatus: null + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: /I.smth + contextReceivers: [] + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: true + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: OPEN + name: smth + origin: DELEGATED + receiverType: kotlin/Int + returnType: kotlin/Short + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /I.bar + contextReceivers: [] + getter: null + hasBackingField: false + hasGetter: false + hasSetter: false + initializer: null + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: OPEN + name: bar + origin: DELEGATED + receiverType: null + returnType: kotlin/Long + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getBar + javaSetterName: setBar + setterDeprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /I.doo + contextReceivers: [] + getter: null + hasBackingField: false + hasGetter: false + hasSetter: false + initializer: null + isConst: false + isDelegatedProperty: false + isExtension: true + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: OPEN + name: doo + origin: DELEGATED + receiverType: kotlin/Int + returnType: kotlin/String + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + getDispatchReceiver(): A + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getDoo + javaSetterName: null + setterDeprecationStatus: null \ No newline at end of file