Fix symbol delegate after build work-around for https://youtrack.jetbrains.com/issue/KT-4012

This commit is contained in:
Alexander Nozik 2021-02-01 12:34:30 +03:00
parent 730678b2fc
commit 8f101c5cd0
2 changed files with 3 additions and 17 deletions

View File

@ -488,15 +488,9 @@ public final class kscience/kmath/expressions/StringSymbol : kscience/kmath/expr
} }
public abstract interface class kscience/kmath/expressions/Symbol { public abstract interface class kscience/kmath/expressions/Symbol {
public static final field Companion Lkscience/kmath/expressions/Symbol$Companion;
public abstract fun getIdentity ()Ljava/lang/String; public abstract fun getIdentity ()Ljava/lang/String;
} }
public final class kscience/kmath/expressions/Symbol$Companion : kotlin/properties/ReadOnlyProperty {
public synthetic fun getValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object;
public fun getValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;)Lkscience/kmath/expressions/Symbol;
}
public abstract interface class kscience/kmath/expressions/SymbolIndexer { public abstract interface class kscience/kmath/expressions/SymbolIndexer {
public abstract fun get (Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; public abstract fun get (Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object;
public abstract fun get (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; public abstract fun get (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object;

View File

@ -3,7 +3,6 @@ package kscience.kmath.expressions
import kscience.kmath.operations.Algebra import kscience.kmath.operations.Algebra
import kotlin.jvm.JvmName import kotlin.jvm.JvmName
import kotlin.properties.ReadOnlyProperty import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
/** /**
* A marker interface for a symbol. A symbol mus have an identity * A marker interface for a symbol. A symbol mus have an identity
@ -13,13 +12,6 @@ public interface Symbol {
* Identity object for the symbol. Two symbols with the same identity are considered to be the same symbol. * Identity object for the symbol. Two symbols with the same identity are considered to be the same symbol.
*/ */
public val identity: String public val identity: String
public companion object : ReadOnlyProperty<Any?, Symbol> {
//TODO deprecate and replace by top level function after fix of https://youtrack.jetbrains.com/issue/KT-40121
override fun getValue(thisRef: Any?, property: KProperty<*>): Symbol {
return StringSymbol(property.name)
}
}
} }
/** /**
@ -103,9 +95,9 @@ public fun <T, E> ExpressionAlgebra<T, E>.bind(symbol: Symbol): E =
/** /**
* A delegate to create a symbol with a string identity in this scope * A delegate to create a symbol with a string identity in this scope
*/ */
public val symbol: ReadOnlyProperty<Any?, Symbol> get() = Symbol public val symbol: ReadOnlyProperty<Any?, Symbol> = ReadOnlyProperty { thisRef, property ->
//TODO does not work directly on native due to https://youtrack.jetbrains.com/issue/KT-40121 StringSymbol(property.name)
}
/** /**
* Bind a symbol by name inside the [ExpressionAlgebra] * Bind a symbol by name inside the [ExpressionAlgebra]