Limit scheme property extension to MutableMeta to avoid override resolution ambiguity
This commit is contained in:
parent
3acbaffecb
commit
671d2b2493
CHANGELOG.mdbuild.gradle.kts
dataforge-io
dataforge-meta/src
commonMain/kotlin/space/kscience/dataforge/meta
commonTest/kotlin/space/kscience/dataforge/meta
@ -15,6 +15,7 @@
|
||||
|
||||
### Fixed
|
||||
- Incorrect work of `MetaWithDefault::getValue`
|
||||
- Incorrect work of scheme delegate
|
||||
|
||||
### Security
|
||||
|
||||
|
@ -9,7 +9,7 @@ plugins {
|
||||
|
||||
allprojects {
|
||||
group = "space.kscience"
|
||||
version = "0.10.1-dev"
|
||||
version = "0.10.1-dev-1"
|
||||
}
|
||||
|
||||
subprojects {
|
||||
|
@ -4,8 +4,6 @@ plugins {
|
||||
|
||||
description = "IO module"
|
||||
|
||||
val ioVersion = "0.6.0"
|
||||
|
||||
kscience {
|
||||
jvm()
|
||||
js()
|
||||
@ -17,8 +15,8 @@ kscience {
|
||||
}
|
||||
dependencies {
|
||||
api(projects.dataforgeContext)
|
||||
api("org.jetbrains.kotlinx:kotlinx-io-core:$ioVersion")
|
||||
api("org.jetbrains.kotlinx:kotlinx-io-bytestring:$ioVersion")
|
||||
api(spclibs.kotlinx.io.core)
|
||||
api(spclibs.kotlinx.io.bytestring)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,15 +219,15 @@ public fun <T : Scheme> Configurable.updateWith(
|
||||
|
||||
|
||||
/**
|
||||
* A delegate that uses a [MetaReader] to wrap a child of this provider
|
||||
* A delegate that uses a [SchemeSpec] to wrap a child of this provider
|
||||
*/
|
||||
public fun <T : Scheme> MutableMetaProvider.scheme(
|
||||
public fun <T : Scheme> MutableMeta.scheme(
|
||||
spec: SchemeSpec<T>,
|
||||
key: Name? = null,
|
||||
): ReadWriteProperty<Any?, T> = object : ReadWriteProperty<Any?, T> {
|
||||
override fun getValue(thisRef: Any?, property: KProperty<*>): T {
|
||||
val name = key ?: property.name.asName()
|
||||
val node = get(name) ?: MutableMeta().also { set(name, it) }
|
||||
val node = getOrCreate(name)
|
||||
return spec.write(node)
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ public fun <T : Scheme> Scheme.scheme(
|
||||
): ReadWriteProperty<Any?, T> = meta.scheme(spec, key)
|
||||
|
||||
/**
|
||||
* A delegate that uses a [MetaReader] to wrap a child of this provider.
|
||||
* A delegate that uses a [SchemeSpec] to wrap a child of this provider.
|
||||
* Returns null if meta with given name does not exist.
|
||||
*/
|
||||
public fun <T : Scheme> MutableMeta.schemeOrNull(
|
||||
|
@ -37,7 +37,6 @@ private class SchemeWithInit: Scheme(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
class SpecificationTest {
|
||||
|
||||
// @Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user