Fix enum delegate bug (KT-37503)
This commit is contained in:
parent
e0aab57953
commit
5c3d51de58
@ -6,7 +6,7 @@ plugins {
|
|||||||
id("scientifik.publish") version toolsVersion apply false
|
id("scientifik.publish") version toolsVersion apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
val dataforgeVersion by extra("0.1.6-dev")
|
val dataforgeVersion by extra("0.1.6-dev-1")
|
||||||
|
|
||||||
val bintrayRepo by extra("dataforge")
|
val bintrayRepo by extra("dataforge")
|
||||||
val githubProject by extra("dataforge-core")
|
val githubProject by extra("dataforge-core")
|
||||||
|
@ -171,7 +171,10 @@ fun Configurable.float(default: Float, key: Name? = null): ReadWriteProperty<Any
|
|||||||
inline fun <reified E : Enum<E>> Configurable.enum(
|
inline fun <reified E : Enum<E>> Configurable.enum(
|
||||||
default: E, key: Name? = null
|
default: E, key: Name? = null
|
||||||
): ReadWriteProperty<Any?, E> =
|
): ReadWriteProperty<Any?, E> =
|
||||||
item(default, key).transform { item -> item?.string?.let { enumValueOf<E>(it) } ?: default }
|
item(default, key).transform { item -> item?.string?.let {str->
|
||||||
|
@Suppress("USELESS_CAST")
|
||||||
|
enumValueOf<E>(str) as E
|
||||||
|
} ?: default }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extra delegates for special cases
|
* Extra delegates for special cases
|
||||||
|
Loading…
Reference in New Issue
Block a user