K2: prefer base class sources for JVM mapped functions
This commit is a follow-up to 3cb9396b20
"K2: prefer derived class sources for callable copies (e.g. fake overrides)"
#KT-64044 Fixed
This commit is contained in:
committed by
Space Team
parent
c80854eb7c
commit
f5453690a6
@@ -223,6 +223,7 @@ class JvmMappedScope(
|
||||
newDispatchReceiverType = kotlinDispatchReceiverType,
|
||||
newParameterTypes = oldFunction.valueParameters.map { substitutor.substituteOrSelf(it.returnTypeRef.coneType) },
|
||||
newReturnType = substitutor.substituteOrSelf(oldFunction.returnTypeRef.coneType),
|
||||
newSource = symbol.fir.source,
|
||||
).apply {
|
||||
if (jdkMemberStatus == JDKMemberStatus.HIDDEN) {
|
||||
isHiddenEverywhereBesideSuperCalls = true
|
||||
@@ -295,7 +296,8 @@ class JvmMappedScope(
|
||||
newTypeParameters = null,
|
||||
newContextReceiverTypes = emptyList(),
|
||||
isExpect = false,
|
||||
callableCopySubstitutionForTypeUpdater = null
|
||||
callableCopySubstitutionForTypeUpdater = null,
|
||||
newSource = oldConstructor.source,
|
||||
)
|
||||
return newSymbol
|
||||
}
|
||||
|
||||
+4
-2
@@ -120,8 +120,9 @@ object FirFakeOverrideGenerator {
|
||||
newModality: Modality? = null,
|
||||
newVisibility: Visibility? = null,
|
||||
callableCopySubstitutionForTypeUpdater: CallableCopySubstitution? = null,
|
||||
newSource: KtSourceElement? = null,
|
||||
): FirSimpleFunction = buildSimpleFunction {
|
||||
source = derivedClassLookupTag?.toSymbol(session)?.source ?: baseFunction.source
|
||||
source = newSource ?: derivedClassLookupTag?.toSymbol(session)?.source ?: baseFunction.source
|
||||
moduleData = session.nullableModuleData ?: baseFunction.moduleData
|
||||
this.origin = origin
|
||||
name = baseFunction.name
|
||||
@@ -153,11 +154,12 @@ object FirFakeOverrideGenerator {
|
||||
newTypeParameters: List<FirTypeParameterRef>?,
|
||||
isExpect: Boolean,
|
||||
callableCopySubstitutionForTypeUpdater: CallableCopySubstitution?,
|
||||
newSource: KtSourceElement? = null,
|
||||
): FirConstructor = buildConstructor {
|
||||
// TODO: consider using here some light-weight functions instead of pseudo-real FirMemberFunctionImpl
|
||||
// As second alternative, we can invent some light-weight kind of FirRegularClass
|
||||
annotations += baseConstructor.annotations
|
||||
source = derivedClassLookupTag?.toSymbol(session)?.source ?: baseConstructor.source
|
||||
source = newSource ?: derivedClassLookupTag?.toSymbol(session)?.source ?: baseConstructor.source
|
||||
moduleData = session.nullableModuleData ?: baseConstructor.moduleData
|
||||
this.origin = origin
|
||||
receiverParameter = baseConstructor.receiverParameter?.let { receiverParameter ->
|
||||
|
||||
Reference in New Issue
Block a user