diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt index 1c5208069e4..f00ddd9aa04 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt @@ -121,9 +121,9 @@ object FirFakeOverrideGenerator { newModality: Modality? = null, newVisibility: Visibility? = null, deferredReturnTypeCalculation: CallableCopyDeferredReturnTypeCalculation? = null, - newSource: KtSourceElement? = null, + newSource: KtSourceElement? = derivedClassLookupTag?.toSymbol(session)?.source ?: baseFunction.source, ): FirSimpleFunction = buildSimpleFunction { - source = newSource ?: derivedClassLookupTag?.toSymbol(session)?.source ?: baseFunction.source + source = newSource moduleData = session.nullableModuleData ?: baseFunction.moduleData this.origin = origin name = baseFunction.name @@ -401,8 +401,9 @@ object FirFakeOverrideGenerator { newModality: Modality? = null, newVisibility: Visibility? = null, deferredReturnTypeCalculation: CallableCopyDeferredReturnTypeCalculation? = null, + newSource: KtSourceElement? = derivedClassLookupTag?.toSymbol(session)?.source ?: baseProperty.source, ): FirProperty = buildProperty { - source = derivedClassLookupTag?.toSymbol(session)?.source ?: baseProperty.source + source = newSource moduleData = session.nullableModuleData ?: baseProperty.moduleData this.origin = origin name = baseProperty.name diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScopeContext.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScopeContext.kt index ad957682535..fba9607217c 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScopeContext.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScopeContext.kt @@ -358,6 +358,7 @@ class FirTypeIntersectionScopeContext( newDispatchReceiverType = dispatchReceiverType, deferredReturnTypeCalculation = deferredReturnTypeCalculation, newReturnType = if (!forClassUseSiteScope && deferredReturnTypeCalculation == null) intersectReturnTypes(mostSpecific) else null, + newSource = dispatchReceiverType.toSymbol(session)?.source, ).apply { originalForIntersectionOverrideAttr = keyFir } @@ -385,7 +386,8 @@ class FirTypeIntersectionScopeContext( deferredReturnTypeCalculation = deferredReturnTypeCalculation, // If any of the properties are vars and the types are not equal, these declarations are conflicting // anyway and their uses should result in an overload resolution error. - newReturnType = returnType + newReturnType = returnType, + newSource = dispatchReceiverType.toSymbol(session)?.source, ) } }