KT-53154 extract implementation of enumEntries into an expect/actual internal helper function
It's required, so it can be implemented in different backends at a different pace and in a different manner
This commit is contained in:
committed by
Space Team
parent
40a6c81d97
commit
61175889b9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -29,14 +29,12 @@ public sealed interface EnumEntries<E : Enum<E>> : List<E>
|
||||
@PublishedApi
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.9")
|
||||
internal inline fun <reified T : Enum<T>> enumEntries(): EnumEntries<T> {
|
||||
/*
|
||||
* Implementation note: this body will be replaced with `throw NotImplementedException()` the moment
|
||||
* all backends starts intrinsifying this call.
|
||||
* Then this method will also be promoted to public.
|
||||
*/
|
||||
return enumEntries(enumValues<T>())
|
||||
}
|
||||
internal inline fun <reified T : Enum<T>> enumEntries(): EnumEntries<T> = enumEntriesIntrinsic()
|
||||
|
||||
@PublishedApi
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.9")
|
||||
internal expect inline fun <reified T : Enum<T>> enumEntriesIntrinsic(): EnumEntries<T>
|
||||
|
||||
@PublishedApi
|
||||
@SinceKotlin("1.8") // Used by pre-1.9.0 JVM compiler for the feature in preview mode. Can be safely removed around 2.1
|
||||
|
||||
Reference in New Issue
Block a user