FIR: Fix serialization of non-delegated members in FirDelegatedMemberScope
This commit is contained in:
committed by
TeamCityServer
parent
3671b14e5b
commit
a3f64f65f2
+26
-1
@@ -33,7 +33,7 @@ class FirDelegatedMemberScope(
|
||||
private val containingClass: FirClass,
|
||||
private val declaredMemberScope: FirScope,
|
||||
private val delegateFields: List<FirField>,
|
||||
) : FirScope() {
|
||||
) : FirScope(), FirContainingNamesAwareScope {
|
||||
private val dispatchReceiverType = containingClass.defaultType()
|
||||
private val overrideChecker = FirStandardOverrideChecker(session)
|
||||
|
||||
@@ -171,6 +171,31 @@ class FirDelegatedMemberScope(
|
||||
result += delegatedSymbol
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
private val callableNamesLazy: Set<Name> by lazy(LazyThreadSafetyMode.PUBLICATION) {
|
||||
buildSet {
|
||||
addAll(declaredMemberScope.getContainingCallableNamesIfPresent())
|
||||
|
||||
delegateFields.flatMapTo(this) {
|
||||
buildScope(it)?.getCallableNames() ?: emptySet()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
private val classifierNamesLazy: Set<Name> by lazy(LazyThreadSafetyMode.PUBLICATION) {
|
||||
buildSet {
|
||||
addAll(declaredMemberScope.getContainingClassifierNamesIfPresent())
|
||||
|
||||
delegateFields.flatMapTo(this) {
|
||||
buildScope(it)?.getClassifierNames() ?: emptySet()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getCallableNames(): Set<Name> = callableNamesLazy
|
||||
override fun getClassifierNames(): Set<Name> = classifierNamesLazy
|
||||
}
|
||||
|
||||
private object MultipleDelegatesWithTheSameSignatureKey : FirDeclarationDataKey()
|
||||
|
||||
@@ -14,15 +14,16 @@ interface UClass : PsiClass {
|
||||
|
||||
abstract class BaseKotlinUClass(
|
||||
psi: PsiClass,
|
||||
val w: String,
|
||||
) : UClass, PsiClass by psi
|
||||
|
||||
// MODULE: main(base)
|
||||
// FILE: main.kt
|
||||
|
||||
class A(psi: PsiClass) : BaseKotlinUClass(psi)
|
||||
class A(psi: PsiClass) : BaseKotlinUClass(psi, "K")
|
||||
|
||||
fun bar(uClass: UClass): String = uClass.foo()!!
|
||||
fun bar(uClass: UClass): String = uClass.foo()!! + (uClass as BaseKotlinUClass).w
|
||||
|
||||
fun box(): String = bar(A(object : PsiClass {
|
||||
override fun foo(): String? = "OK"
|
||||
override fun foo(): String? = "O"
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user