K2: Make filterOutOverridden helper satisfying its contracts

It's obviously expected that all overridden, not only direct ones
are considered

While it likely changes the behavior and some tests are expected to be
changed, original intention was to fix the behavior for other usages
(see later commits) and the part with tests are postponed with KT-58636

^KT-58636 Related
This commit is contained in:
Denis.Zharkov
2023-05-11 12:23:28 +02:00
committed by Space Team
parent 85059ced93
commit efdecc63cb
2 changed files with 18 additions and 16 deletions
@@ -78,6 +78,7 @@ class MemberWithBaseScope<out D : FirCallableSymbol<*>>(val member: D, val baseS
}
typealias ProcessOverriddenWithBaseScope<D> = FirTypeScope.(D, (D, FirTypeScope) -> ProcessorAction) -> ProcessorAction
typealias ProcessAllOverridden<D> = FirTypeScope.(D, (D) -> ProcessorAction) -> ProcessorAction
fun FirTypeScope.processOverriddenFunctions(
functionSymbol: FirNamedFunctionSymbol,
@@ -159,6 +160,13 @@ private fun <S : FirCallableSymbol<*>> FirTypeScope.doProcessAllOverriddenCallab
}
}
fun <S : FirCallableSymbol<*>> FirTypeScope.processAllOverriddenCallables(
callableSymbol: S,
processor: (S) -> ProcessorAction,
processDirectOverriddenCallablesWithBaseScope: ProcessOverriddenWithBaseScope<S>,
): ProcessorAction =
doProcessAllOverriddenCallables(callableSymbol, processor, processDirectOverriddenCallablesWithBaseScope, mutableSetOf())
private fun <S : FirCallableSymbol<*>> FirTypeScope.doProcessAllOverriddenCallables(
callableSymbol: S,
processor: (S) -> ProcessorAction,