[K/JS, K/Wasm] Implement enumEntries top-level function ^KT-59712 Fixed

This commit is contained in:
Artem Kobzar
2023-07-27 09:43:01 +00:00
committed by Space Team
parent 34b271b13d
commit 029c71ebb1
10 changed files with 41 additions and 12 deletions
@@ -9,6 +9,10 @@ package kotlin.enums
@SinceKotlin("1.8")
public sealed interface EnumEntries<E : Enum<E>>
@PublishedApi
@ExperimentalStdlibApi
internal external fun <T: Enum<T>> enumEntriesIntrinsic(): EnumEntries<T>
@PublishedApi
@ExperimentalStdlibApi
@SinceKotlin("1.8")
@@ -8,10 +8,6 @@ package kotlin.enums
@SinceKotlin("1.9")
@ExperimentalStdlibApi
@PublishedApi
internal actual inline fun <reified T : Enum<T>> enumEntriesIntrinsic(): EnumEntries<T> {
/*
* Implementation note: this body will be replaced with `throw NotImplementedException()` the moment
* all backends starts intrinsifying this call.
*/
return enumEntries(enumValues<T>())
}
// TODO: After the expect fun enumEntriesIntrinsic become non-inline function, the suppress and external keyword should be removed
@Suppress("INLINE_EXTERNAL_DECLARATION", "WRONG_JS_INTEROP_TYPE")
internal actual external inline fun <reified T : Enum<T>> enumEntriesIntrinsic(): EnumEntries<T>