diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeDependentAnalysisSourceModuleScopeContextForPositionTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeDependentAnalysisSourceModuleScopeContextForPositionTestGenerated.java
index f436bdbfe26..eb45fdb379f 100644
--- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeDependentAnalysisSourceModuleScopeContextForPositionTestGenerated.java
+++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeDependentAnalysisSourceModuleScopeContextForPositionTestGenerated.java
@@ -88,6 +88,18 @@ public class FirIdeDependentAnalysisSourceModuleScopeContextForPositionTestGener
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/errorType.kt");
}
+ @Test
+ @TestMetadata("kDocOnClass.kt")
+ public void testKDocOnClass() throws Exception {
+ runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnClass.kt");
+ }
+
+ @Test
+ @TestMetadata("kDocOnFunction.kt")
+ public void testKDocOnFunction() throws Exception {
+ runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnFunction.kt");
+ }
+
@Test
@TestMetadata("kDocWithoutDeclaration.kt")
public void testKDocWithoutDeclaration() throws Exception {
diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeNormalAnalysisSourceModuleScopeContextForPositionTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeNormalAnalysisSourceModuleScopeContextForPositionTestGenerated.java
index a2d2eb3a503..bc23396fa0b 100644
--- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeNormalAnalysisSourceModuleScopeContextForPositionTestGenerated.java
+++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeNormalAnalysisSourceModuleScopeContextForPositionTestGenerated.java
@@ -88,6 +88,18 @@ public class FirIdeNormalAnalysisSourceModuleScopeContextForPositionTestGenerate
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/errorType.kt");
}
+ @Test
+ @TestMetadata("kDocOnClass.kt")
+ public void testKDocOnClass() throws Exception {
+ runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnClass.kt");
+ }
+
+ @Test
+ @TestMetadata("kDocOnFunction.kt")
+ public void testKDocOnFunction() throws Exception {
+ runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnFunction.kt");
+ }
+
@Test
@TestMetadata("kDocWithoutDeclaration.kt")
public void testKDocWithoutDeclaration() throws Exception {
diff --git a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/scopeProvider/FirStandaloneNormalAnalysisSourceModuleScopeContextForPositionTestGenerated.java b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/scopeProvider/FirStandaloneNormalAnalysisSourceModuleScopeContextForPositionTestGenerated.java
index 4560dc60384..0cb0f88b1fc 100644
--- a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/scopeProvider/FirStandaloneNormalAnalysisSourceModuleScopeContextForPositionTestGenerated.java
+++ b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/scopeProvider/FirStandaloneNormalAnalysisSourceModuleScopeContextForPositionTestGenerated.java
@@ -88,6 +88,18 @@ public class FirStandaloneNormalAnalysisSourceModuleScopeContextForPositionTestG
runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/errorType.kt");
}
+ @Test
+ @TestMetadata("kDocOnClass.kt")
+ public void testKDocOnClass() throws Exception {
+ runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnClass.kt");
+ }
+
+ @Test
+ @TestMetadata("kDocOnFunction.kt")
+ public void testKDocOnFunction() throws Exception {
+ runTest("analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnFunction.kt");
+ }
+
@Test
@TestMetadata("kDocWithoutDeclaration.kt")
public void testKDocWithoutDeclaration() throws Exception {
diff --git a/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnClass.kt b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnClass.kt
new file mode 100644
index 00000000000..13dbdba7ef6
--- /dev/null
+++ b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnClass.kt
@@ -0,0 +1,13 @@
+package test
+
+class Param1
+
+class Param2
+
+/**
+ * [param1]
+ */
+class MyClass(param1: Param1, param2: Param2) {
+ val property: Int = 10
+ fun member(): Int = 10
+}
\ No newline at end of file
diff --git a/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnClass.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnClass.pretty.txt
new file mode 100644
index 00000000000..a3a027e1141
--- /dev/null
+++ b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnClass.pretty.txt
@@ -0,0 +1,54 @@
+element: param1
+implicit receivers:
+ type: test.MyClass
+ owner symbol: KtFirNamedClassOrObjectSymbol
+
+scopes:
+ TypeScope, index = 0
+ packages: 0
+ classifiers: 0
+ callables: 5
+ val property: kotlin.Int
+ fun member(): kotlin.Int
+ fun equals(other: kotlin.Any?): kotlin.Boolean
+ fun hashCode(): kotlin.Int
+ fun toString(): kotlin.String
+ constructors: 1
+ constructor(param1: test.Param1, param2: test.Param2)
+
+ TypeParameterScope, index = 1
+ packages: 0
+ classifiers: 1
+ TypeParam
+ callables: 0
+ constructors: 0
+
+ ExplicitSimpleImportingScope, index = 2
+ packages: 0
+ classifiers: 0
+ callables: 0
+ constructors: 0
+
+ PackageMemberScope, index = 3
+ packages: 0
+ classifiers: 3
+ class Param1
+ class Param2
+ class MyClass(param1: test.Param1, param2: test.Param2)
+ callables: 0
+ constructors: 0
+
+ DefaultSimpleImportingScope, index = 4
+
+ DefaultSimpleImportingScope, index = 5
+
+ ExplicitStarImportingScope, index = 6
+ packages: 0
+ classifiers: 0
+ callables: 0
+ constructors: 0
+
+ DefaultSimpleImportingScope, index = 7
+
+ DefaultStarImportingScope, index = 8
+
diff --git a/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnClass.txt b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnClass.txt
new file mode 100644
index 00000000000..72d701432da
--- /dev/null
+++ b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnClass.txt
@@ -0,0 +1,406 @@
+element: param1
+implicit receivers:
+ type: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: [
+ KtTypeParameterType:
+ annotationsList: []
+ type: TypeParam
+ ]
+ type: test/MyClass
+ owner symbol: KtFirNamedClassOrObjectSymbol
+
+scopes:
+ TypeScope, index = 0
+ packages: 0
+ classifiers: 0
+ callables: 5
+ KtKotlinPropertySymbol:
+ annotationsList: []
+ backingFieldSymbol: KtBackingFieldSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: null
+ contextReceivers: []
+ isExtension: false
+ name: field
+ origin: PROPERTY_BACKING_FIELD
+ owningProperty: KtKotlinPropertySymbol(test/MyClass.property)
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: kotlin/Int
+ symbolKind: LOCAL
+ typeParameters: []
+ callableIdIfNonLocal: test/MyClass.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: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: kotlin/Int
+ symbolKind: ACCESSOR
+ typeParameters: []
+ valueParameters: []
+ visibility: Public
+ hasBackingField: true
+ hasGetter: true
+ hasSetter: false
+ initializer: KtConstantInitializerValue(10)
+ isActual: false
+ isConst: false
+ isDelegatedProperty: false
+ isExpect: false
+ isExtension: false
+ isFromPrimaryConstructor: false
+ isLateInit: false
+ isOverride: false
+ isStatic: false
+ isVal: true
+ modality: FINAL
+ name: property
+ origin: SOURCE
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: kotlin/Int
+ setter: null
+ symbolKind: CLASS_MEMBER
+ typeParameters: []
+ visibility: Public
+ KtFunctionSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: test/MyClass.member
+ 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: member
+ origin: SOURCE
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: kotlin/Int
+ symbolKind: CLASS_MEMBER
+ typeParameters: []
+ valueParameters: []
+ visibility: Public
+ KtFunctionSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: kotlin/Any.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: OPEN
+ 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: []
+ ]
+ visibility: Public
+ KtFunctionSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: kotlin/Any.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: OPEN
+ name: hashCode
+ origin: LIBRARY
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: kotlin/Int
+ symbolKind: CLASS_MEMBER
+ typeParameters: []
+ valueParameters: []
+ visibility: Public
+ KtFunctionSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: kotlin/Any.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
+ constructors: 1
+ KtConstructorSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: null
+ containingClassIdIfNonLocal: test/MyClass
+ contextReceivers: []
+ hasStableParameterNames: true
+ isActual: false
+ isExpect: false
+ isExtension: false
+ isPrimary: true
+ origin: SOURCE
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: [
+ KtTypeParameterType:
+ annotationsList: []
+ type: TypeParam
+ ]
+ type: test/MyClass
+ symbolKind: CLASS_MEMBER
+ typeParameters: [
+ KtTypeParameterSymbol(TypeParam)
+ ]
+ valueParameters: [
+ KtValueParameterSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: null
+ contextReceivers: []
+ generatedPrimaryConstructorProperty: null
+ hasDefaultValue: false
+ isCrossinline: false
+ isExtension: false
+ isImplicitLambdaParameter: false
+ isNoinline: false
+ isVararg: false
+ name: param1
+ origin: SOURCE
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: test/Param1
+ symbolKind: LOCAL
+ typeParameters: []
+ KtValueParameterSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: null
+ contextReceivers: []
+ generatedPrimaryConstructorProperty: null
+ hasDefaultValue: false
+ isCrossinline: false
+ isExtension: false
+ isImplicitLambdaParameter: false
+ isNoinline: false
+ isVararg: false
+ name: param2
+ origin: SOURCE
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: test/Param2
+ symbolKind: LOCAL
+ typeParameters: []
+ ]
+ visibility: Public
+
+ TypeParameterScope, index = 1
+ packages: 0
+ classifiers: 1
+ KtTypeParameterSymbol:
+ annotationsList: []
+ isReified: false
+ name: TypeParam
+ origin: SOURCE
+ typeParameters: []
+ upperBounds: []
+ variance: INVARIANT
+ callables: 0
+ constructors: 0
+
+ ExplicitSimpleImportingScope, index = 2
+ packages: 0
+ classifiers: 0
+ callables: 0
+ constructors: 0
+
+ PackageMemberScope, index = 3
+ packages: 0
+ classifiers: 3
+ KtNamedClassOrObjectSymbol:
+ annotationsList: []
+ classIdIfNonLocal: test/Param1
+ classKind: CLASS
+ companionObject: null
+ contextReceivers: []
+ isActual: false
+ isData: false
+ isExpect: false
+ isExternal: false
+ isFun: false
+ isInline: false
+ isInner: false
+ modality: FINAL
+ name: Param1
+ origin: SOURCE
+ superTypes: [
+ KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: kotlin/Any
+ ]
+ symbolKind: TOP_LEVEL
+ typeParameters: []
+ visibility: Public
+ KtNamedClassOrObjectSymbol:
+ annotationsList: []
+ classIdIfNonLocal: test/Param2
+ classKind: CLASS
+ companionObject: null
+ contextReceivers: []
+ isActual: false
+ isData: false
+ isExpect: false
+ isExternal: false
+ isFun: false
+ isInline: false
+ isInner: false
+ modality: FINAL
+ name: Param2
+ origin: SOURCE
+ superTypes: [
+ KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: kotlin/Any
+ ]
+ symbolKind: TOP_LEVEL
+ typeParameters: []
+ visibility: Public
+ KtNamedClassOrObjectSymbol:
+ annotationsList: []
+ classIdIfNonLocal: test/MyClass
+ classKind: CLASS
+ companionObject: null
+ contextReceivers: []
+ isActual: false
+ isData: false
+ isExpect: false
+ isExternal: false
+ isFun: false
+ isInline: false
+ isInner: false
+ modality: FINAL
+ name: MyClass
+ origin: SOURCE
+ superTypes: [
+ KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: kotlin/Any
+ ]
+ symbolKind: TOP_LEVEL
+ typeParameters: [
+ KtTypeParameterSymbol(TypeParam)
+ ]
+ visibility: Public
+ callables: 0
+ constructors: 0
+
+ DefaultSimpleImportingScope, index = 4
+
+ DefaultSimpleImportingScope, index = 5
+
+ ExplicitStarImportingScope, index = 6
+ packages: 0
+ classifiers: 0
+ callables: 0
+ constructors: 0
+
+ DefaultSimpleImportingScope, index = 7
+
+ DefaultStarImportingScope, index = 8
+
diff --git a/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnFunction.kt b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnFunction.kt
new file mode 100644
index 00000000000..2eabbc6c675
--- /dev/null
+++ b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnFunction.kt
@@ -0,0 +1,12 @@
+package test
+
+class Receiver
+
+class Param1
+
+class Param2
+
+/**
+ * [param1]
+ */
+fun Receiver.function(param1: Param1, param2: Param2): TypeParam {}
\ No newline at end of file
diff --git a/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnFunction.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnFunction.pretty.txt
new file mode 100644
index 00000000000..cf08b735cce
--- /dev/null
+++ b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnFunction.pretty.txt
@@ -0,0 +1,60 @@
+element: param1
+implicit receivers:
+ type: test.Receiver
+ owner symbol: KtFirFunctionSymbol
+
+scopes:
+ TypeScope, index = 0
+ packages: 0
+ classifiers: 0
+ callables: 3
+ fun equals(other: kotlin.Any?): kotlin.Boolean
+ fun hashCode(): kotlin.Int
+ fun toString(): kotlin.String
+ constructors: 1
+ constructor()
+
+ LocalScope, index = 1
+ packages: 0
+ classifiers: 0
+ callables: 2
+ param1: test.Param1
+ param2: test.Param2
+ constructors: 0
+
+ TypeParameterScope, index = 2
+ packages: 0
+ classifiers: 1
+ TypeParam
+ callables: 0
+ constructors: 0
+
+ ExplicitSimpleImportingScope, index = 3
+ packages: 0
+ classifiers: 0
+ callables: 0
+ constructors: 0
+
+ PackageMemberScope, index = 4
+ packages: 0
+ classifiers: 3
+ class Receiver
+ class Param1
+ class Param2
+ callables: 1
+ fun test.Receiver.function(param1: test.Param1, param2: test.Param2): TypeParam
+ constructors: 0
+
+ DefaultSimpleImportingScope, index = 5
+
+ DefaultSimpleImportingScope, index = 6
+
+ ExplicitStarImportingScope, index = 7
+ packages: 0
+ classifiers: 0
+ callables: 0
+ constructors: 0
+
+ DefaultSimpleImportingScope, index = 8
+
+ DefaultStarImportingScope, index = 9
diff --git a/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnFunction.txt b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnFunction.txt
new file mode 100644
index 00000000000..4a55105825f
--- /dev/null
+++ b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/kDocOnFunction.txt
@@ -0,0 +1,381 @@
+element: param1
+implicit receivers:
+ type: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: test/Receiver
+ owner symbol: KtFirFunctionSymbol
+
+scopes:
+ TypeScope, index = 0
+ packages: 0
+ classifiers: 0
+ callables: 3
+ KtFunctionSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: kotlin/Any.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: OPEN
+ 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: []
+ ]
+ visibility: Public
+ KtFunctionSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: kotlin/Any.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: OPEN
+ name: hashCode
+ origin: LIBRARY
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: kotlin/Int
+ symbolKind: CLASS_MEMBER
+ typeParameters: []
+ valueParameters: []
+ visibility: Public
+ KtFunctionSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: kotlin/Any.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
+ constructors: 1
+ KtConstructorSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: null
+ containingClassIdIfNonLocal: test/Receiver
+ contextReceivers: []
+ hasStableParameterNames: true
+ isActual: false
+ isExpect: false
+ isExtension: false
+ isPrimary: true
+ origin: SOURCE_MEMBER_GENERATED
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: test/Receiver
+ symbolKind: CLASS_MEMBER
+ typeParameters: []
+ valueParameters: []
+ visibility: Public
+
+ LocalScope, index = 1
+ packages: 0
+ classifiers: 0
+ callables: 2
+ KtValueParameterSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: null
+ contextReceivers: []
+ generatedPrimaryConstructorProperty: null
+ hasDefaultValue: false
+ isCrossinline: false
+ isExtension: false
+ isImplicitLambdaParameter: false
+ isNoinline: false
+ isVararg: false
+ name: param1
+ origin: SOURCE
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: test/Param1
+ symbolKind: LOCAL
+ typeParameters: []
+ KtValueParameterSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: null
+ contextReceivers: []
+ generatedPrimaryConstructorProperty: null
+ hasDefaultValue: false
+ isCrossinline: false
+ isExtension: false
+ isImplicitLambdaParameter: false
+ isNoinline: false
+ isVararg: false
+ name: param2
+ origin: SOURCE
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: test/Param2
+ symbolKind: LOCAL
+ typeParameters: []
+ constructors: 0
+
+ TypeParameterScope, index = 2
+ packages: 0
+ classifiers: 1
+ KtTypeParameterSymbol:
+ annotationsList: []
+ isReified: false
+ name: TypeParam
+ origin: SOURCE
+ typeParameters: []
+ upperBounds: []
+ variance: INVARIANT
+ callables: 0
+ constructors: 0
+
+ ExplicitSimpleImportingScope, index = 3
+ packages: 0
+ classifiers: 0
+ callables: 0
+ constructors: 0
+
+ PackageMemberScope, index = 4
+ packages: 0
+ classifiers: 3
+ KtNamedClassOrObjectSymbol:
+ annotationsList: []
+ classIdIfNonLocal: test/Receiver
+ classKind: CLASS
+ companionObject: null
+ contextReceivers: []
+ isActual: false
+ isData: false
+ isExpect: false
+ isExternal: false
+ isFun: false
+ isInline: false
+ isInner: false
+ modality: FINAL
+ name: Receiver
+ origin: SOURCE
+ superTypes: [
+ KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: kotlin/Any
+ ]
+ symbolKind: TOP_LEVEL
+ typeParameters: []
+ visibility: Public
+ KtNamedClassOrObjectSymbol:
+ annotationsList: []
+ classIdIfNonLocal: test/Param1
+ classKind: CLASS
+ companionObject: null
+ contextReceivers: []
+ isActual: false
+ isData: false
+ isExpect: false
+ isExternal: false
+ isFun: false
+ isInline: false
+ isInner: false
+ modality: FINAL
+ name: Param1
+ origin: SOURCE
+ superTypes: [
+ KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: kotlin/Any
+ ]
+ symbolKind: TOP_LEVEL
+ typeParameters: []
+ visibility: Public
+ KtNamedClassOrObjectSymbol:
+ annotationsList: []
+ classIdIfNonLocal: test/Param2
+ classKind: CLASS
+ companionObject: null
+ contextReceivers: []
+ isActual: false
+ isData: false
+ isExpect: false
+ isExternal: false
+ isFun: false
+ isInline: false
+ isInner: false
+ modality: FINAL
+ name: Param2
+ origin: SOURCE
+ superTypes: [
+ KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: kotlin/Any
+ ]
+ symbolKind: TOP_LEVEL
+ typeParameters: []
+ visibility: Public
+ callables: 1
+ KtFunctionSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: test/function
+ contextReceivers: []
+ contractEffects: []
+ hasStableParameterNames: true
+ isActual: false
+ isBuiltinFunctionInvoke: false
+ isExpect: false
+ isExtension: true
+ isExternal: false
+ isInfix: false
+ isInline: false
+ isOperator: false
+ isOverride: false
+ isStatic: false
+ isSuspend: false
+ modality: FINAL
+ name: function
+ origin: SOURCE
+ receiverParameter: KtReceiverParameterSymbol:
+ annotationsList: []
+ origin: SOURCE
+ owningCallableSymbol: KtFunctionSymbol(test/function)
+ type: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: test/Receiver
+ returnType: KtTypeParameterType:
+ annotationsList: []
+ type: TypeParam
+ symbolKind: TOP_LEVEL
+ typeParameters: [
+ KtTypeParameterSymbol(TypeParam)
+ ]
+ valueParameters: [
+ KtValueParameterSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: null
+ contextReceivers: []
+ generatedPrimaryConstructorProperty: null
+ hasDefaultValue: false
+ isCrossinline: false
+ isExtension: false
+ isImplicitLambdaParameter: false
+ isNoinline: false
+ isVararg: false
+ name: param1
+ origin: SOURCE
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: test/Param1
+ symbolKind: LOCAL
+ typeParameters: []
+ KtValueParameterSymbol:
+ annotationsList: []
+ callableIdIfNonLocal: null
+ contextReceivers: []
+ generatedPrimaryConstructorProperty: null
+ hasDefaultValue: false
+ isCrossinline: false
+ isExtension: false
+ isImplicitLambdaParameter: false
+ isNoinline: false
+ isVararg: false
+ name: param2
+ origin: SOURCE
+ receiverParameter: null
+ returnType: KtUsualClassType:
+ annotationsList: []
+ ownTypeArguments: []
+ type: test/Param2
+ symbolKind: LOCAL
+ typeParameters: []
+ ]
+ visibility: Public
+ constructors: 0
+
+ DefaultSimpleImportingScope, index = 5
+
+ DefaultSimpleImportingScope, index = 6
+
+ ExplicitStarImportingScope, index = 7
+ packages: 0
+ classifiers: 0
+ callables: 0
+ constructors: 0
+
+ DefaultSimpleImportingScope, index = 8
+
+ DefaultStarImportingScope, index = 9
diff --git a/analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_class.kt b/analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_class.kt
new file mode 100644
index 00000000000..4fa03afb6d3
--- /dev/null
+++ b/analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_class.kt
@@ -0,0 +1,6 @@
+package test
+
+class ContextReceiver
+
+context(ContextReceiver)
+class MyClass(param: String)
\ No newline at end of file
diff --git a/analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_class.txt b/analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_class.txt
new file mode 100644
index 00000000000..b301faa81fe
--- /dev/null
+++ b/analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_class.txt
@@ -0,0 +1,45 @@
+Tower Data Context:
+ Element 0
+ Scope: FirDefaultStarImportingScope
+ Element 1
+ Scope: FirDefaultSimpleImportingScope
+ Element 2
+ Scope: FirExplicitStarImportingScope
+ Element 3
+ Scope: FirDefaultSimpleImportingScope
+ Element 4
+ Scope: FirDefaultSimpleImportingScope
+ Element 5
+ Scope: FirPackageMemberScope
+ Element 6
+ Scope: FirExplicitSimpleImportingScope
+ Element 7
+ Scope: FirMemberTypeParameterScope
+ Classifiers:
+ FirTypeParameterSymbol T
+ Element 8
+ Implicit receiver:
+ FirRegularClassSymbol context(R|test/ContextReceiver|)
+ public final class MyClass : R|kotlin/Any|
+ Type: test.MyClass
+ Element 9
+ Context receivers:
+ FirRegularClassSymbol context(R|test/ContextReceiver|)
+ public final class MyClass : R|kotlin/Any|
+ Type: test.ContextReceiver
+ Label: ContextReceiver
+
+FILE: [ResolvedTo(IMPORTS)] wholeDeclaration_class.kt
+ public final [ResolvedTo(STATUS)] class ContextReceiver : R|kotlin/Any| {
+ public [ResolvedTo(STATUS)] constructor(): R|test/ContextReceiver| {
+ LAZY_super
+ }
+
+ }
+ context(R|test/ContextReceiver|)
+ public final [ResolvedTo(STATUS)] class MyClass<[ResolvedTo(STATUS)] T> : R|kotlin/Any| {
+ public [ResolvedTo(STATUS)] constructor<[ResolvedTo(STATUS)] T>([ResolvedTo(STATUS)] param: R|kotlin/String|): R|test/MyClass| {
+ LAZY_super
+ }
+
+ }
diff --git a/analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_fun.kt b/analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_fun.kt
new file mode 100644
index 00000000000..53412833bfe
--- /dev/null
+++ b/analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_fun.kt
@@ -0,0 +1,8 @@
+package test
+
+class ContextReceiver
+
+class Receiver
+
+context(ContextReceiver)
+fun Receiver.test(param: String): T {}
\ No newline at end of file
diff --git a/analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_fun.txt b/analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_fun.txt
new file mode 100644
index 00000000000..360f3704319
--- /dev/null
+++ b/analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_fun.txt
@@ -0,0 +1,51 @@
+Tower Data Context:
+ Element 0
+ Scope: FirDefaultStarImportingScope
+ Element 1
+ Scope: FirDefaultSimpleImportingScope
+ Element 2
+ Scope: FirExplicitStarImportingScope
+ Element 3
+ Scope: FirDefaultSimpleImportingScope
+ Element 4
+ Scope: FirDefaultSimpleImportingScope
+ Element 5
+ Scope: FirPackageMemberScope
+ Element 6
+ Scope: FirExplicitSimpleImportingScope
+ Element 7
+ Scope: FirMemberTypeParameterScope
+ Classifiers:
+ FirTypeParameterSymbol T
+ Element 8
+ Scope: FirLocalScope
+ Properties:
+ FirValueParameterSymbol param: R|kotlin/String|
+ Element 9
+ Context receivers:
+ FirNamedFunctionSymbol context(R|test/ContextReceiver|)
+ public final fun R|test/Receiver|.test(param: R|kotlin/String|): R|T|
+ Type: test.ContextReceiver
+ Label: ContextReceiver
+ Element 10
+ Implicit receiver:
+ FirNamedFunctionSymbol context(R|test/ContextReceiver|)
+ public final fun R|test/Receiver|.test(param: R|kotlin/String|): R|T|
+ Type: test.Receiver
+
+FILE: [ResolvedTo(IMPORTS)] wholeDeclaration_fun.kt
+ public final [ResolvedTo(STATUS)] class ContextReceiver : R|kotlin/Any| {
+ public [ResolvedTo(STATUS)] constructor(): R|test/ContextReceiver| {
+ LAZY_super
+ }
+
+ }
+ public final [ResolvedTo(STATUS)] class Receiver : R|kotlin/Any| {
+ public [ResolvedTo(STATUS)] constructor(): R|test/Receiver| {
+ LAZY_super
+ }
+
+ }
+ context(R|test/ContextReceiver|)
+ public final [ResolvedTo(BODY_RESOLVE)] fun <[ResolvedTo(BODY_RESOLVE)] T> R|test/Receiver|.test([ResolvedTo(BODY_RESOLVE)] param: R|kotlin/String|): R|T| {
+ }
diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/ContextCollectorSourceTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/ContextCollectorSourceTestGenerated.java
index 970e164e84e..ae912b435fe 100644
--- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/ContextCollectorSourceTestGenerated.java
+++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/ContextCollectorSourceTestGenerated.java
@@ -108,6 +108,18 @@ public class ContextCollectorSourceTestGenerated extends AbstractContextCollecto
runTest("analysis/low-level-api-fir/testData/contextCollector/simple.kt");
}
+ @Test
+ @TestMetadata("wholeDeclaration_class.kt")
+ public void testWholeDeclaration_class() throws Exception {
+ runTest("analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_class.kt");
+ }
+
+ @Test
+ @TestMetadata("wholeDeclaration_fun.kt")
+ public void testWholeDeclaration_fun() throws Exception {
+ runTest("analysis/low-level-api-fir/testData/contextCollector/wholeDeclaration_fun.kt");
+ }
+
@Nested
@TestMetadata("analysis/low-level-api-fir/testData/contextCollector/classHeaderPositions")
@TestDataPath("$PROJECT_ROOT")