[FIR2IR] Don't enter same class twice while override searching
This commit fixes 21 unmuted BB tests after previous one
This commit is contained in:
@@ -289,12 +289,13 @@ internal tailrec fun FirCallableSymbol<*>.deepestMatchingOverriddenSymbol(root:
|
|||||||
internal fun IrClass.findMatchingOverriddenSymbolsFromSupertypes(
|
internal fun IrClass.findMatchingOverriddenSymbolsFromSupertypes(
|
||||||
irBuiltIns: IrBuiltIns,
|
irBuiltIns: IrBuiltIns,
|
||||||
target: IrDeclaration,
|
target: IrDeclaration,
|
||||||
result: MutableList<IrSymbol> = mutableListOf()
|
result: MutableList<IrSymbol> = mutableListOf(),
|
||||||
|
visited: MutableSet<IrClass> = mutableSetOf()
|
||||||
): List<IrSymbol> {
|
): List<IrSymbol> {
|
||||||
for (superType in superTypes) {
|
for (superType in superTypes) {
|
||||||
val superTypeClass = superType.classOrNull
|
val superTypeClass = superType.classOrNull
|
||||||
if (superTypeClass is IrClassSymbolImpl) {
|
if (superTypeClass is IrClassSymbolImpl) {
|
||||||
superTypeClass.owner.findMatchingOverriddenSymbolsFromThisAndSupertypes(irBuiltIns, target, result)
|
superTypeClass.owner.findMatchingOverriddenSymbolsFromThisAndSupertypes(irBuiltIns, target, result, visited)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
@@ -303,8 +304,13 @@ internal fun IrClass.findMatchingOverriddenSymbolsFromSupertypes(
|
|||||||
private fun IrClass.findMatchingOverriddenSymbolsFromThisAndSupertypes(
|
private fun IrClass.findMatchingOverriddenSymbolsFromThisAndSupertypes(
|
||||||
irBuiltIns: IrBuiltIns,
|
irBuiltIns: IrBuiltIns,
|
||||||
target: IrDeclaration,
|
target: IrDeclaration,
|
||||||
result: MutableList<IrSymbol>
|
result: MutableList<IrSymbol>,
|
||||||
|
visited: MutableSet<IrClass>
|
||||||
): List<IrSymbol> {
|
): List<IrSymbol> {
|
||||||
|
if (this in visited) {
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
visited += this
|
||||||
val targetIsPropertyAccessor = target is IrFunction && target.isPropertyAccessor
|
val targetIsPropertyAccessor = target is IrFunction && target.isPropertyAccessor
|
||||||
for (declaration in declarations) {
|
for (declaration in declarations) {
|
||||||
if (declaration.isFakeOverride || declaration is IrConstructor) {
|
if (declaration.isFakeOverride || declaration is IrConstructor) {
|
||||||
@@ -355,7 +361,7 @@ private fun IrClass.findMatchingOverriddenSymbolsFromThisAndSupertypes(
|
|||||||
if (result.isNotEmpty()) {
|
if (result.isNotEmpty()) {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
return findMatchingOverriddenSymbolsFromSupertypes(irBuiltIns, target, result)
|
return findMatchingOverriddenSymbolsFromSupertypes(irBuiltIns, target, result, visited)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isOverriding(
|
fun isOverriding(
|
||||||
|
|||||||
Reference in New Issue
Block a user