abstract class A extends Data[A](...)
case object B extends A
case object C extends A
def setA(x: Sym[_], a: A): Unit = metadata.add(x, a)
def readA(x: Sym[_]): Option[A] = metadata[A](x)
x.setA(x, B)
readA(x)
In the current metadata implementation, the above will return None after readA, even though we've set metadata of B on x. This is because B has type of B.type, whereas we're looking for Class[A] when we try to read. For now should allow overriding the key on subclasses, but should have a more elegant solution here.
In the current metadata implementation, the above will return None after readA, even though we've set metadata of B on x. This is because B has type of B.type, whereas we're looking for Class[A] when we try to read. For now should allow overriding the key on subclasses, but should have a more elegant solution here.