[FE] Fix 'containingClassForStaticMemberAttr' for fake overrides (KTIJ-22808)

This commit is contained in:
Yan Zhulanow
2022-10-24 15:35:38 +09:00
committed by Space Team
parent 2e9f9f987b
commit fe69b21aed
19 changed files with 176 additions and 84 deletions
@@ -93,7 +93,7 @@ object JavaScopeProvider : FirScopeProvider() {
)
val superTypeScopes = superTypes.mapNotNull {
it.scopeForSupertype(useSiteSession, scopeSession, subClass = regularClass)
it.scopeForSupertype(useSiteSession, scopeSession, regularClass)
}
JavaClassUseSiteMemberScope(
@@ -81,6 +81,7 @@ private fun wrapSubstitutionScopeIfNeed(
session, useSiteMemberScope, PLATFORM_TYPE_PARAMETERS_SUBSTITUTION_SCOPE_KEY, substitutor,
dispatchReceiverTypeForSubstitutedMembers = derivedClass.defaultType(),
skipPrivateMembers = true,
derivedClassLookupTag = derivedClass.symbol.toLookupTag()
)
}
}
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.fir.scopes.jvm
import org.jetbrains.kotlin.builtins.jvm.JvmBuiltInsSignatures
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.containingClassForStaticMemberAttr
import org.jetbrains.kotlin.fir.declarations.FirClass
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
import org.jetbrains.kotlin.fir.declarations.utils.classId
@@ -81,6 +80,7 @@ class JvmMappedScope(
FirFakeOverrideGenerator.createCopyForFirFunction(
newSymbol,
baseFunction = symbol.fir,
derivedClassLookupTag = firKotlinClass.symbol.toLookupTag(),
session,
symbol.fir.origin,
newDispatchReceiverType = kotlinDispatchReceiverType,
@@ -125,6 +125,7 @@ class JvmMappedScope(
newSymbol,
session,
oldConstructor,
derivedClassLookupTag = firKotlinClass.symbol.toLookupTag(),
symbol.fir.origin,
newDispatchReceiverType = null,
newReturnType = substitutor.substituteOrSelf(oldConstructor.returnTypeRef.coneType),
@@ -133,9 +134,7 @@ class JvmMappedScope(
newContextReceiverTypes = emptyList(),
isExpect = false,
fakeOverrideSubstitution = null
).apply {
containingClassForStaticMemberAttr = firKotlinClass.symbol.toLookupTag()
}
)
newSymbol
}
}