[FIR] Ignore private properties in accessor override check
JavaClassUseSiteMemberScope won't return a Java method getFoo if there is an inherited Kotlin property foo in scope because calling this method would effectively call the property accessor which is not possible in Kotlin. This commit excludes private properties from this consideration because no accessor methods are generated for them, and so calling a Java method getFoo is ok. #KT-58577 Fixed
This commit is contained in:
committed by
Space Team
parent
442844f165
commit
993925f656
+3
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.java.scopes
|
||||
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
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.buildSimpleFunctionCopy
|
||||
@@ -549,6 +550,8 @@ class JavaClassUseSiteMemberScope(
|
||||
}
|
||||
|
||||
private fun FirPropertySymbol.isOverriddenInClassBy(functionSymbol: FirNamedFunctionSymbol): Boolean {
|
||||
if (rawStatus.visibility == Visibilities.Private) return false
|
||||
|
||||
val accessorDescriptors = when (val fir = fir) {
|
||||
is FirSyntheticProperty -> {
|
||||
if (fir.getter.delegate.symbol == functionSymbol || fir.setter?.delegate?.symbol == functionSymbol) return true
|
||||
|
||||
Reference in New Issue
Block a user