Skip to content

Commit

Permalink
IR: repair collectAndFilterRealOverrides
Browse files Browse the repository at this point in the history
(cherry picked from commit 91387e6)
  • Loading branch information
Georgy Bronnikov authored and Space committed Jul 6, 2021
1 parent 70522f6 commit d9dd7f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.collectAndFilterRealOverrides
import org.jetbrains.kotlin.ir.util.isReal
import org.jetbrains.kotlin.ir.util.render
import org.jetbrains.kotlin.resolve.OverridingUtil.OverrideCompatibilityInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ fun <S : IrSymbol, T : IrOverridableDeclaration<S>> Collection<T>.collectAndFilt
return realOverrides.values.toSet()
}

fun Collection<IrOverridableMember>.collectAndFilterRealOverrides(): Set<IrOverridableMember> =
@Suppress("UNCHECKED_CAST")
(this as Collection<IrOverridableDeclaration<*>>).collectAndFilterRealOverrides()
@Suppress("UNCHECKED_CAST")
fun Collection<IrOverridableMember>.collectAndFilterRealOverrides(): Set<IrOverridableMember> = when {
all { it is IrSimpleFunction } -> (this as Collection<IrSimpleFunction>).collectAndFilterRealOverrides()
all { it is IrProperty } -> (this as Collection<IrProperty>).collectAndFilterRealOverrides()
else -> error("all members should be of the same kind, got ${map { it.render() }}")
}

// TODO: use this implementation instead of any other
fun <S : IrSymbol, T : IrOverridableDeclaration<S>> T.resolveFakeOverride(
Expand Down

0 comments on commit d9dd7f6

Please sign in to comment.