Mark polymorphic attribute getters and setters as unstable

This commit is contained in:
Alexander Nozik 2024-03-27 07:43:54 +03:00
parent 82196250f6
commit 69b59b43f4
2 changed files with 3 additions and 1 deletions

View File

@ -21,11 +21,13 @@ public abstract class PolymorphicAttribute<T>(public val type: SafeType<T>) : At
/** /**
* Get a polymorphic attribute using attribute factory * Get a polymorphic attribute using attribute factory
*/ */
@UnstableAttributesAPI
public operator fun <T> Attributes.get(attributeKeyBuilder: () -> PolymorphicAttribute<T>): T? = get(attributeKeyBuilder()) public operator fun <T> Attributes.get(attributeKeyBuilder: () -> PolymorphicAttribute<T>): T? = get(attributeKeyBuilder())
/** /**
* Set a polymorphic attribute using its factory * Set a polymorphic attribute using its factory
*/ */
@UnstableAttributesAPI
public operator fun <O, T> AttributesBuilder<O>.set(attributeKeyBuilder: () -> PolymorphicAttribute<T>, value: T) { public operator fun <O, T> AttributesBuilder<O>.set(attributeKeyBuilder: () -> PolymorphicAttribute<T>, value: T) {
set(attributeKeyBuilder(), value) set(attributeKeyBuilder(), value)
} }

View File

@ -24,7 +24,7 @@ public val <T> OptimizationProblem<T>.startPoint: Map<Symbol, T>
get() = attributes[OptimizationStartPoint()] ?: error("Starting point not defined in $this") get() = attributes[OptimizationStartPoint()] ?: error("Starting point not defined in $this")
public fun <T> AttributesBuilder<OptimizationProblem<T>>.startAt(startingPoint: Map<Symbol, T>) { public fun <T> AttributesBuilder<OptimizationProblem<T>>.startAt(startingPoint: Map<Symbol, T>) {
set(::OptimizationStartPoint, startingPoint) set(OptimizationStartPoint(), startingPoint)
} }