diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeDependentAnalysisSourceModuleTypeScopeTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeDependentAnalysisSourceModuleTypeScopeTestGenerated.java index e4f8de48efe..e5b1032be41 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeDependentAnalysisSourceModuleTypeScopeTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeDependentAnalysisSourceModuleTypeScopeTestGenerated.java @@ -76,6 +76,12 @@ public class FirIdeDependentAnalysisSourceModuleTypeScopeTestGenerated extends A runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.kt"); } + @Test + @TestMetadata("substitutedTypeFromLib.kt") + public void testSubstitutedTypeFromLib() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.kt"); + } + @Test @TestMetadata("typeParamList.kt") public void testTypeParamList() throws Exception { diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeNormalAnalysisSourceModuleTypeScopeTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeNormalAnalysisSourceModuleTypeScopeTestGenerated.java index 3197d2673f8..dc5beccd483 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeNormalAnalysisSourceModuleTypeScopeTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/scopeProvider/FirIdeNormalAnalysisSourceModuleTypeScopeTestGenerated.java @@ -76,6 +76,12 @@ public class FirIdeNormalAnalysisSourceModuleTypeScopeTestGenerated extends Abst runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.kt"); } + @Test + @TestMetadata("substitutedTypeFromLib.kt") + public void testSubstitutedTypeFromLib() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.kt"); + } + @Test @TestMetadata("typeParamList.kt") public void testTypeParamList() throws Exception { diff --git a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/scopeProvider/FirStandaloneNormalAnalysisSourceModuleTypeScopeTestGenerated.java b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/scopeProvider/FirStandaloneNormalAnalysisSourceModuleTypeScopeTestGenerated.java index c0d10540209..42e6ff36fc8 100644 --- a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/scopeProvider/FirStandaloneNormalAnalysisSourceModuleTypeScopeTestGenerated.java +++ b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/scopeProvider/FirStandaloneNormalAnalysisSourceModuleTypeScopeTestGenerated.java @@ -76,6 +76,12 @@ public class FirStandaloneNormalAnalysisSourceModuleTypeScopeTestGenerated exten runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/outerTypeParamsSubstitution.kt"); } + @Test + @TestMetadata("substitutedTypeFromLib.kt") + public void testSubstitutedTypeFromLib() throws Exception { + runTest("analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.kt"); + } + @Test @TestMetadata("typeParamList.kt") public void testTypeParamList() throws Exception { diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.kt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.kt new file mode 100644 index 00000000000..696cfe1fcbd --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.kt @@ -0,0 +1,9 @@ +// WITH_STDLIB + +fun foo() { + val l = listOf(1, 2, 3) + val l2 = l.map { it * 2 to it } + + val el = l2.find { it.first == 1 } ?: return + println(el) +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.pretty.txt new file mode 100644 index 00000000000..26830c188f6 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.pretty.txt @@ -0,0 +1,20 @@ +KtTypeScope: +fun component1(): kotlin.Int +fun component2(): kotlin.Int +fun copy(first: kotlin.Int, second: kotlin.Int): kotlin.Pair +fun equals(other: kotlin.Any?): kotlin.Boolean +fun hashCode(): kotlin.Int +fun toString(): kotlin.String +val first: kotlin.Int +val second: kotlin.Int + + +Declaration Scope: +fun component1(): A +fun component2(): B +fun copy(first: A, second: B): kotlin.Pair +fun equals(other: kotlin.Any?): kotlin.Boolean +fun hashCode(): kotlin.Int +fun toString(): kotlin.String +val first: A +val second: B diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.standalone.fir.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.standalone.fir.txt new file mode 100644 index 00000000000..9e789ab4b06 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.standalone.fir.txt @@ -0,0 +1,441 @@ +expression: el +KtType: kotlin.Pair + +KtTypeScope: +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Pair.component1(: kotlin.Pair): A + valueParameters = [] + callableIdIfNonLocal = kotlin/Pair.component1 +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Pair.component2(: kotlin.Pair): B + valueParameters = [] + callableIdIfNonLocal = kotlin/Pair.component2 +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Pair + symbol = kotlin/Pair.copy(: kotlin.Pair, first: A, second: B): kotlin.Pair + valueParameters = [ + KtVariableLikeSignature: + name = first + receiverType = null + returnType = kotlin.Int + symbol = first: A + callableIdIfNonLocal = null, + KtVariableLikeSignature: + name = second + receiverType = null + returnType = kotlin.Int + symbol = second: B + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/Pair.copy +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/Pair.equals(: kotlin.Pair, other: kotlin.Any?): kotlin.Boolean + valueParameters = [ + KtVariableLikeSignature: + name = other + receiverType = null + returnType = kotlin.Any? + symbol = other: kotlin.Any? + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/Pair.equals +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Pair.hashCode(: kotlin.Pair): kotlin.Int + valueParameters = [] + callableIdIfNonLocal = kotlin/Pair.hashCode +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = kotlin/Pair.toString(: kotlin.Pair): kotlin.String + valueParameters = [] + callableIdIfNonLocal = kotlin/Pair.toString +KtVariableLikeSignature: + name = first + receiverType = null + returnType = kotlin.Int + symbol = val first: A + callableIdIfNonLocal = kotlin/Pair.first +KtVariableLikeSignature: + name = second + receiverType = null + returnType = kotlin.Int + symbol = val second: B + callableIdIfNonLocal = kotlin/Pair.second + + +Declaration Scope: +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Pair.component1 + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: component1 + origin: LIBRARY + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: A + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Pair.component2 + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: component2 + origin: LIBRARY + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: B + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Pair.copy + 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: copy + origin: LIBRARY + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: A + KtTypeParameterType: + annotationsList: [] + type: B + ] + type: kotlin/Pair + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: true + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: first + origin: LIBRARY + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: A + symbolKind: LOCAL + typeParameters: [] + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: true + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: second + origin: LIBRARY + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: B + symbolKind: LOCAL + typeParameters: [] + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Pair.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/Pair.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/Pair.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 +KtKotlinPropertySymbol: + annotationsList: [] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(kotlin/Pair.first) + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: A + symbolKind: LOCAL + typeParameters: [] + callableIdIfNonLocal: kotlin/Pair.first + contextReceivers: [] + getter: KtPropertyGetterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasBody: false + hasStableParameterNames: true + isDefault: true + isExtension: false + isInline: false + isOverride: false + modality: FINAL + origin: LIBRARY + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: A + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: null + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: first + origin: LIBRARY + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: A + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public +KtKotlinPropertySymbol: + annotationsList: [] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(kotlin/Pair.second) + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: B + symbolKind: LOCAL + typeParameters: [] + callableIdIfNonLocal: kotlin/Pair.second + contextReceivers: [] + getter: KtPropertyGetterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasBody: false + hasStableParameterNames: true + isDefault: true + isExtension: false + isInline: false + isOverride: false + modality: FINAL + origin: LIBRARY + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: B + symbolKind: ACCESSOR + typeParameters: [] + valueParameters: [] + visibility: Public + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: null + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: second + origin: LIBRARY + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: B + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.txt new file mode 100644 index 00000000000..9cf77ce6f68 --- /dev/null +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/substitutedTypeFromLib.txt @@ -0,0 +1,402 @@ +expression: el +KtType: kotlin.Pair + +KtTypeScope: +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Pair.component1(: kotlin.Pair): A + valueParameters = [] + callableIdIfNonLocal = kotlin/Pair.component1 +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Pair.component2(: kotlin.Pair): B + valueParameters = [] + callableIdIfNonLocal = kotlin/Pair.component2 +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Pair + symbol = kotlin/Pair.copy(: kotlin.Pair, first: A, second: B): kotlin.Pair + valueParameters = [ + KtVariableLikeSignature: + name = first + receiverType = null + returnType = kotlin.Int + symbol = first: A + callableIdIfNonLocal = null, + KtVariableLikeSignature: + name = second + receiverType = null + returnType = kotlin.Int + symbol = second: B + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/Pair.copy +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = kotlin/Pair.equals(: kotlin.Pair, other: kotlin.Any?): kotlin.Boolean + valueParameters = [ + KtVariableLikeSignature: + name = other + receiverType = null + returnType = kotlin.Any? + symbol = other: kotlin.Any? + callableIdIfNonLocal = null + ] + callableIdIfNonLocal = kotlin/Pair.equals +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Pair.hashCode(: kotlin.Pair): kotlin.Int + valueParameters = [] + callableIdIfNonLocal = kotlin/Pair.hashCode +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = kotlin/Pair.toString(: kotlin.Pair): kotlin.String + valueParameters = [] + callableIdIfNonLocal = kotlin/Pair.toString +KtVariableLikeSignature: + name = first + receiverType = null + returnType = kotlin.Int + symbol = val first: A + callableIdIfNonLocal = kotlin/Pair.first +KtVariableLikeSignature: + name = second + receiverType = null + returnType = kotlin.Int + symbol = val second: B + callableIdIfNonLocal = kotlin/Pair.second + + +Declaration Scope: +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Pair.component1 + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: component1 + origin: LIBRARY + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: A + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Pair.component2 + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: true + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: component2 + origin: LIBRARY + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: B + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Pair.copy + 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: copy + origin: SOURCE_MEMBER_GENERATED + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [ + KtTypeParameterType: + annotationsList: [] + type: A + KtTypeParameterType: + annotationsList: [] + type: B + ] + type: kotlin/Pair + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [ + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: true + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: first + origin: SOURCE_MEMBER_GENERATED + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: A + symbolKind: LOCAL + typeParameters: [] + KtValueParameterSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + generatedPrimaryConstructorProperty: null + hasDefaultValue: true + isCrossinline: false + isExtension: false + isImplicitLambdaParameter: false + isNoinline: false + isVararg: false + name: second + origin: SOURCE_MEMBER_GENERATED + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: B + symbolKind: LOCAL + typeParameters: [] + ] + visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: kotlin/Pair.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/Pair.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/Pair.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 +KtKotlinPropertySymbol: + annotationsList: [] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(kotlin/Pair.first) + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: A + symbolKind: LOCAL + typeParameters: [] + callableIdIfNonLocal: kotlin/Pair.first + contextReceivers: [] + getter: null + hasBackingField: true + hasGetter: false + hasSetter: false + initializer: null + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: first + origin: LIBRARY + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: A + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public +KtKotlinPropertySymbol: + annotationsList: [] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(kotlin/Pair.second) + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: B + symbolKind: LOCAL + typeParameters: [] + callableIdIfNonLocal: kotlin/Pair.second + contextReceivers: [] + getter: null + hasBackingField: true + hasGetter: false + hasSetter: false + initializer: null + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: second + origin: LIBRARY + receiverParameter: null + returnType: KtTypeParameterType: + annotationsList: [] + type: B + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/StubBasedClassDeserialization.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/StubBasedClassDeserialization.kt index a901b3db9d6..20bf6c3083e 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/StubBasedClassDeserialization.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/StubBasedClassDeserialization.kt @@ -226,13 +226,14 @@ internal fun deserializeClassToSymbol( classOrObject, context.dispatchReceiver, zippedParameters, + createResolvedStatus = true, createClassTypeRefWithSourceKind = { firPrimaryConstructor.returnTypeRef.copyWithNewSourceKind(it) }, createParameterTypeRefWithSourceKind = { property, newKind -> property.returnTypeRef.copyWithNewSourceKind(newKind) }, toFirSource = { src, kind -> KtFakeSourceElement(src as PsiElement, kind) }, addValueParameterAnnotations = { annotations += context.annotationDeserializer.loadAnnotations(it) }, - isVararg = { it.isVarArg } + isVararg = { it.isVarArg }, ) ) } diff --git a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilder.kt b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilder.kt index 0fbf945b22f..9750552d1de 100644 --- a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilder.kt +++ b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/AbstractRawFirBuilder.kt @@ -11,12 +11,14 @@ import org.jetbrains.kotlin.* import org.jetbrains.kotlin.KtNodeTypes.* import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.descriptors.EffectiveVisibility import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.builder.* import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl +import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl import org.jetbrains.kotlin.fir.declarations.utils.* import org.jetbrains.kotlin.fir.diagnostics.* import org.jetbrains.kotlin.fir.expressions.* @@ -972,6 +974,7 @@ abstract class AbstractRawFirBuilder(val baseSession: FirSession, val context source, currentDispatchReceiverType(), zippedParameters, + createResolvedStatus = false, createClassTypeRefWithSourceKind, createParameterTypeRefWithSourceKind, { src, kind -> src?.toFirSourceElement(kind) }, @@ -1110,6 +1113,7 @@ fun FirRegularClassBuilder.createDa sourceElement: TSource, dispatchReceiver: ConeClassLikeType?, zippedParameters: List>, + createResolvedStatus: Boolean, createClassTypeRefWithSourceKind: (KtFakeSourceElementKind) -> FirTypeRef, createParameterTypeRefWithSourceKind: (FirProperty, KtFakeSourceElementKind) -> FirTypeRef, toFirSource: (TBase?, KtFakeSourceElementKind) -> KtSourceElement?, @@ -1146,10 +1150,14 @@ fun FirRegularClassBuilder.createDa origin = FirDeclarationOrigin.Synthetic.DataClassMember returnTypeRef = classTypeRef name = StandardNames.DATA_CLASS_COPY - status = FirDeclarationStatusImpl(Visibilities.Public, Modality.FINAL) symbol = FirNamedFunctionSymbol(CallableId(classId.packageFqName, classId.relativeClassName, StandardNames.DATA_CLASS_COPY)) dispatchReceiverType = dispatchReceiver resolvePhase = this@createDataClassCopyFunction.resolvePhase + status = if (createResolvedStatus) { + FirResolvedDeclarationStatusImpl(Visibilities.Public, Modality.FINAL, EffectiveVisibility.Public) + } else { + FirDeclarationStatusImpl(Visibilities.Public, Modality.FINAL) + } for ((ktParameter, firProperty) in zippedParameters) { val propertyName = firProperty.name val parameterSource = toFirSource(ktParameter, KtFakeSourceElementKind.DataClassGeneratedMembers)