From 5ee50f50b5c2154ffaad206f2a640522727afd62 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Fri, 18 Aug 2023 18:23:51 +0200 Subject: [PATCH] K2/LC: set hasBackingField to false for expect properties #KT-61173 Fixed --- .../expectActual.descriptors.txt | 957 ++++++++++++++++++ .../multiModuleSymbolByPsi/expectActual.txt | 4 +- .../symbol/classes/symbolLightClassUtils.kt | 3 +- .../utils/declarationAttributes.kt | 2 +- .../expectMemberInNotExpectClassFir.ir.txt | 5 - ...expectMemberInNotExpectClassFir.sig.kt.txt | 30 +- 6 files changed, 977 insertions(+), 24 deletions(-) create mode 100644 analysis/analysis-api/testData/symbols/multiModuleSymbolByPsi/expectActual.descriptors.txt diff --git a/analysis/analysis-api/testData/symbols/multiModuleSymbolByPsi/expectActual.descriptors.txt b/analysis/analysis-api/testData/symbols/multiModuleSymbolByPsi/expectActual.descriptors.txt new file mode 100644 index 00000000000..af62fca8a3d --- /dev/null +++ b/analysis/analysis-api/testData/symbols/multiModuleSymbolByPsi/expectActual.descriptors.txt @@ -0,0 +1,957 @@ +// FILE: Common.kt + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: sample/A + classKind: OBJECT + companionObject: null + contextReceivers: [] + isActual: false + isData: false + isExpect: true + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: A + origin: SOURCE + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: sample/B + classKind: CLASS + companionObject: null + contextReceivers: [] + isActual: false + isData: false + isExpect: true + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: B + origin: SOURCE + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtConstructorSymbol: + annotationsList: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: sample/B + contextReceivers: [] + hasStableParameterNames: true + isActual: false + isExpect: true + isExtension: false + isPrimary: true + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: sample/B + 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: s + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/String + symbolKind: LOCAL + typeParameters: [] + ] + visibility: Public + +KtConstructorSymbol: + annotationsList: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: sample/B + contextReceivers: [] + hasStableParameterNames: true + isActual: false + isExpect: true + isExtension: false + isPrimary: false + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: sample/B + 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: n + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + ] + visibility: Public + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: sample/B.Nested + classKind: CLASS + companionObject: null + contextReceivers: [] + isActual: false + isData: false + isExpect: true + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Nested + origin: SOURCE + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: sample/B.bar + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: true + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: bar + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Unit + 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(sample/B.n) + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + callableIdIfNonLocal: sample/B.n + 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: null + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: true + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: n + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: sample/C + classKind: CLASS + companionObject: null + contextReceivers: [] + isActual: false + isData: false + isExpect: true + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: C + origin: SOURCE + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: sample/C.Nested + classKind: CLASS + companionObject: null + contextReceivers: [] + isActual: false + isData: false + isExpect: true + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Nested + origin: SOURCE + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: sample/baz + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: false + isBuiltinFunctionInvoke: false + isExpect: true + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: baz + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Unit + symbolKind: TOP_LEVEL + typeParameters: [] + valueParameters: [] + visibility: Public + +KtKotlinPropertySymbol: + annotationsList: [] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(sample/m) + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + callableIdIfNonLocal: sample/m + 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: true + initializer: null + isActual: false + isConst: false + isDelegatedProperty: false + isExpect: true + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: FINAL + name: m + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: 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: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: 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: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + ] + visibility: Public + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +// FILE: JvmAndroid.kt + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: sample/A + classKind: OBJECT + companionObject: null + contextReceivers: [] + isActual: true + isData: false + isExpect: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: A + origin: SOURCE + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: sample/B + classKind: CLASS + companionObject: null + contextReceivers: [] + isActual: true + isData: false + isExpect: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: B + origin: SOURCE + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtConstructorSymbol: + annotationsList: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: sample/B + contextReceivers: [] + hasStableParameterNames: true + isActual: true + isExpect: false + isExtension: false + isPrimary: true + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: sample/B + 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: s + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/String + symbolKind: LOCAL + typeParameters: [] + ] + visibility: Public + +KtConstructorSymbol: + annotationsList: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: sample/B + contextReceivers: [] + hasStableParameterNames: true + isActual: true + isExpect: false + isExtension: false + isPrimary: false + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: sample/B + 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: n + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + ] + visibility: Public + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: sample/B.Nested + classKind: CLASS + companionObject: null + contextReceivers: [] + isActual: true + isData: false + isExpect: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Nested + origin: SOURCE + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: sample/B.bar + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: true + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: bar + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Unit + 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(sample/B.n) + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + callableIdIfNonLocal: sample/B.n + 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(0) + isActual: true + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: n + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + setter: null + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + +KtTypeAliasSymbol: + annotationsList: [] + classIdIfNonLocal: sample/C + expandedType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: sample/D + isActual: true + isExpect: false + name: C + origin: SOURCE + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: sample/D + classKind: CLASS + companionObject: null + contextReceivers: [] + isActual: false + isData: false + isExpect: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: D + origin: SOURCE + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: sample/D.Nested + classKind: CLASS + companionObject: null + contextReceivers: [] + isActual: false + isData: false + isExpect: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Nested + origin: SOURCE + superTypes: [ + KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Any + ] + symbolKind: CLASS_MEMBER + typeParameters: [] + visibility: Public + +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: sample/baz + contextReceivers: [] + contractEffects: [] + hasStableParameterNames: true + isActual: true + isBuiltinFunctionInvoke: false + isExpect: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: FINAL + name: baz + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Unit + symbolKind: TOP_LEVEL + typeParameters: [] + valueParameters: [] + visibility: Public + +KtKotlinPropertySymbol: + annotationsList: [] + backingFieldSymbol: KtBackingFieldSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + isExtension: false + name: field + origin: PROPERTY_BACKING_FIELD + owningProperty: KtKotlinPropertySymbol(sample/m) + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + callableIdIfNonLocal: sample/m + 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: true + initializer: KtConstantInitializerValue(0) + isActual: true + isConst: false + isDelegatedProperty: false + isExpect: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: FINAL + name: m + origin: SOURCE + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: 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: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + receiverParameter: null + returnType: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: 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: KtUsualClassType: + annotationsList: [] + ownTypeArguments: [] + type: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + ] + visibility: Public + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + diff --git a/analysis/analysis-api/testData/symbols/multiModuleSymbolByPsi/expectActual.txt b/analysis/analysis-api/testData/symbols/multiModuleSymbolByPsi/expectActual.txt index af62fca8a3d..e98a2480d04 100644 --- a/analysis/analysis-api/testData/symbols/multiModuleSymbolByPsi/expectActual.txt +++ b/analysis/analysis-api/testData/symbols/multiModuleSymbolByPsi/expectActual.txt @@ -232,7 +232,7 @@ KtKotlinPropertySymbol: typeParameters: [] valueParameters: [] visibility: Public - hasBackingField: true + hasBackingField: false hasGetter: true hasSetter: false initializer: null @@ -381,7 +381,7 @@ KtKotlinPropertySymbol: typeParameters: [] valueParameters: [] visibility: Public - hasBackingField: true + hasBackingField: false hasGetter: true hasSetter: true initializer: null diff --git a/analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/classes/symbolLightClassUtils.kt b/analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/classes/symbolLightClassUtils.kt index 2cc7427ba2f..1c334965cff 100644 --- a/analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/classes/symbolLightClassUtils.kt +++ b/analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/classes/symbolLightClassUtils.kt @@ -435,7 +435,8 @@ private fun hasBackingField(property: KtPropertySymbol): Boolean { } val fieldUseSite = AnnotationUseSiteTarget.FIELD - if (property.modality == Modality.ABSTRACT || + if (property.isExpect || + property.modality == Modality.ABSTRACT || property.isHiddenOrSynthetic(fieldUseSite, fieldUseSite.toOptionalFilter()) ) return false diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/utils/declarationAttributes.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/utils/declarationAttributes.kt index f9714308576..82e572fd9a0 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/utils/declarationAttributes.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/utils/declarationAttributes.kt @@ -81,7 +81,7 @@ val FirPropertySymbol.canNarrowDownGetterType: Boolean // See [BindingContext.BACKING_FIELD_REQUIRED] val FirProperty.hasBackingField: Boolean get() { - if (isAbstract) return false + if (isAbstract || isExpect) return false if (delegate != null) return false if (hasExplicitBackingField) return true if (symbol is FirSyntheticPropertySymbol) return false diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.ir.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.ir.txt index 1c5552d1f06..4ebc706d4f1 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.ir.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.ir.txt @@ -6,14 +6,9 @@ FILE fqName: fileName:/common.kt FUN name:f visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.String [expect] $this: VALUE_PARAMETER name: type:.C1 PROPERTY name:p visibility:public modality:FINAL [expect,val] - FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final] FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.C1) returnType:kotlin.Int correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [expect,val] $this: VALUE_PARAMETER name: type:.C1 - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .C1' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - receiver: GET_VAR ': .C1 declared in .C1.' type=.C1 origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [expect,fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.sig.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.sig.kt.txt index 52dc92e3157..f43b990cd18 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.sig.kt.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectMemberInNotExpectClassFir.sig.kt.txt @@ -5,21 +5,6 @@ // Mangled name: C1 // Public signature: /C1|null[1] expect open class C1 { - // CHECK: - // Mangled name: C1{}p - // Public signature: /C1.p|6715504260787941082[1] - // Public signature debug description: {}p - expect val p: Int - // CHECK JVM_IR: - // Mangled name: C1#(){}kotlin.Int - // Public signature: /C1.p.|5329635969197638839[1] - // Public signature debug description: (){}kotlin.Int - // CHECK JS_IR NATIVE: - // Mangled name: C1#(){} - // Public signature: /C1.p.|-1162552463316289847[1] - // Public signature debug description: (){} - get - // CHECK: // Mangled name: C1#(){} // Public signature: /C1.|-5645683436151566731[1] @@ -36,6 +21,21 @@ expect open class C1 { // Public signature debug description: f(){} expect fun f(): String + // CHECK: + // Mangled name: C1{}p + // Public signature: /C1.p|6715504260787941082[1] + // Public signature debug description: {}p + expect val p: Int + // CHECK JVM_IR: + // Mangled name: C1#(){}kotlin.Int + // Public signature: /C1.p.|5329635969197638839[1] + // Public signature debug description: (){}kotlin.Int + // CHECK JS_IR NATIVE: + // Mangled name: C1#(){} + // Public signature: /C1.p.|-1162552463316289847[1] + // Public signature debug description: (){} + get + } // CHECK: