[FE] Introduce commonized version of expect/actual compatibility calculator
This is needed to use the same code for those checks between both frontends and backend ^KT-58578
This commit is contained in:
committed by
Space Team
parent
2c2f12d9ac
commit
b26b649d4e
@@ -81,10 +81,12 @@ inline fun <T, reified R> Iterable<T>.partitionIsInstance(): Pair<List<R>, List<
|
||||
return Pair(first, second)
|
||||
}
|
||||
|
||||
inline fun <reified T> Iterable<*>.castAll(): Iterable<T> {
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@UnsafeCastFunction
|
||||
inline fun <reified T> List<*>.castAll(): List<@kotlin.internal.NoInfer T> {
|
||||
for (element in this) element as T
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return this as Iterable<T>
|
||||
return this as List<T>
|
||||
}
|
||||
|
||||
fun <T> sequenceOfLazyValues(vararg elements: () -> T): Sequence<T> = elements.asSequence().map { it() }
|
||||
|
||||
Reference in New Issue
Block a user