[FIR] Fir modality of FirPropertyAccessor
^KT-61798 Fixed Review: https://jetbrains.team/p/kt/reviews/14230/timeline Q: How resolved modality of an accessor affects expect/actual matching algorithm of properties? A: It's not expect/actual matching of properties, but expect/actual matching of properties setter. Declarations (setters in our case) in actual are allowed to have wider visibility but only if the appropriate expect is `final`. Before this commit, all property accessors were always `final` by mistake. After this commit, they have the modality derived from their containingProperty. Related problem: PositionStrategy for ACTUAL_WITHOUT_EXPECT can be improved KT-65720 The fix in `resolveModality` is similar to how `resolveVisibility` works Related tests: - ConfigurationCacheForAndroidIT.testKotlinAndroidProject - FirIdeNormalAnalysisSourceModuleCombinedDeclaredMemberScopeTestGenerated.testEnumClassWithAbstractMembers - FirIdeNormalAnalysisSourceModuleCombinedDeclaredMemberScopeTestGenerated.testEnumEntryInitializerWithOverriddenMember - FirIdeNormalAnalysisSourceModuleDeclaredMemberScopeTestGenerated.testDelegateInterfaceLibrary - FirIdeNormalAnalysisSourceModuleDeclaredMemberScopeTestGenerated.testEnumClassWithAbstractMembers - FirIdeNormalAnalysisSourceModuleDeclaredMemberScopeTestGenerated.testEnumEntryInitializerWithOverriddenMember - FirIdeNormalAnalysisSourceModuleMemberScopeTestGenerated.testEnumClassWithAbstractMembers - FirIdeNormalAnalysisSourceModuleMemberScopeTestGenerated.testEnumEntryInitializerWithOverriddenMember - FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.testEnumEntryOverride - FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.testEnumValueMember - FirStandaloneNormalAnalysisSourceModuleCombinedDeclaredMemberScopeTestGenerated.testEnumClassWithAbstractMembers - FirStandaloneNormalAnalysisSourceModuleCombinedDeclaredMemberScopeTestGenerated.testEnumEntryInitializerWithOverriddenMember - FirStandaloneNormalAnalysisSourceModuleDeclaredMemberScopeTestGenerated.testEnumClassWithAbstractMembers - FirStandaloneNormalAnalysisSourceModuleDeclaredMemberScopeTestGenerated.testEnumEntryInitializerWithOverriddenMember - FirStandaloneNormalAnalysisSourceModuleMemberScopeTestGenerated.testEnumClassWithAbstractMembers - FirStandaloneNormalAnalysisSourceModuleMemberScopeTestGenerated.testEnumEntryInitializerWithOverriddenMember - DiagnosticCompilerTestFE10TestdataTestGenerated*testChangeSetterVisibilityInOverride
This commit is contained in:
@@ -87,7 +87,7 @@ FILE fqName:<root> fileName:/genericClassInDifferentModule_m2.kt
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-bar> visibility:public modality:OPEN <> ($this:<root>.Derived1<T of <root>.Derived1>) returnType:T of <root>.Derived1
|
||||
correspondingProperty: PROPERTY name:bar visibility:public modality:OPEN [var]
|
||||
overridden:
|
||||
public final fun <get-bar> (): T of <root>.Base declared in <root>.Base
|
||||
public abstract fun <get-bar> (): T of <root>.Base declared in <root>.Base
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Derived1<T of <root>.Derived1>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun <get-bar> (): T of <root>.Derived1 declared in <root>.Derived1'
|
||||
@@ -96,7 +96,7 @@ FILE fqName:<root> fileName:/genericClassInDifferentModule_m2.kt
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-bar> visibility:public modality:OPEN <> ($this:<root>.Derived1<T of <root>.Derived1>, <set-?>:T of <root>.Derived1) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:bar visibility:public modality:OPEN [var]
|
||||
overridden:
|
||||
public final fun <set-bar> (value: T of <root>.Base): kotlin.Unit declared in <root>.Base
|
||||
public abstract fun <set-bar> (value: T of <root>.Base): kotlin.Unit declared in <root>.Base
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Derived1<T of <root>.Derived1>
|
||||
VALUE_PARAMETER name:<set-?> index:0 type:T of <root>.Derived1
|
||||
BLOCK_BODY
|
||||
@@ -109,7 +109,7 @@ FILE fqName:<root> fileName:/genericClassInDifferentModule_m2.kt
|
||||
FUN name:<get-exn> visibility:public modality:OPEN <Z> ($this:<root>.Derived1<T of <root>.Derived1>, $receiver:Z of <root>.Derived1.<get-exn>) returnType:T of <root>.Derived1
|
||||
correspondingProperty: PROPERTY name:exn visibility:public modality:OPEN [var]
|
||||
overridden:
|
||||
public final fun <get-exn> <Z> (): T of <root>.Base declared in <root>.Base
|
||||
public abstract fun <get-exn> <Z> (): T of <root>.Base declared in <root>.Base
|
||||
TYPE_PARAMETER name:Z index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Derived1<T of <root>.Derived1>
|
||||
$receiver: VALUE_PARAMETER name:<this> type:Z of <root>.Derived1.<get-exn>
|
||||
@@ -120,7 +120,7 @@ FILE fqName:<root> fileName:/genericClassInDifferentModule_m2.kt
|
||||
FUN name:<set-exn> visibility:public modality:OPEN <Z> ($this:<root>.Derived1<T of <root>.Derived1>, $receiver:Z of <root>.Derived1.<set-exn>, value:T of <root>.Derived1) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:exn visibility:public modality:OPEN [var]
|
||||
overridden:
|
||||
public final fun <set-exn> <Z> (value: T of <root>.Base): kotlin.Unit declared in <root>.Base
|
||||
public abstract fun <set-exn> <Z> (value: T of <root>.Base): kotlin.Unit declared in <root>.Base
|
||||
TYPE_PARAMETER name:Z index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Derived1<T of <root>.Derived1>
|
||||
$receiver: VALUE_PARAMETER name:<this> type:Z of <root>.Derived1.<set-exn>
|
||||
|
||||
Reference in New Issue
Block a user