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:
Mikhail Glukhikh
2023-12-20 16:14:44 +01:00
committed by Space Team
parent c80854eb7c
commit f5453690a6
11 changed files with 64 additions and 7 deletions
@@ -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
}