You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import shapeless.syntax.singleton._
import shapeless.record._
it("can get name singleton") {
val t1 = NameOf.nameOfType[Seq[Int]]
val record = (t1 ->> "r") :: "a" ->> 5 :: HNil
val r = record.apply("Seq")
println(r)
}
which compiles to the following error:
[Error] /home/peng/git/shapesafe/core/src/test/scala/org/shapesafe/core/debugging/InfoCTSpec.scala:19: No field String("Seq") in record String with shapeless.labelled.KeyTag[t1.type,String] :: Int with shapeless.labelled.KeyTag[String("a"),Int] :: shapeless.HNil
one error found
This doesn't use the full potential of the macro, as t1 can be assigned a singleton type "Seq" in scala 2.13, or a witnessed type in scala < 2.13 using shapeless
The following works however in scala 2.13, not sure how:
import shapeless.syntax.singleton._
import shapeless.record._
it("can get name singleton") {
val t1: "Seq" = NameOf.nameOfType[Seq[Int]]
val record = (t1 ->> "r") :: "a" ->> 5 :: HNil
val r = record.apply("Seq")
println(r)
}
The text was updated successfully, but these errors were encountered:
Demo:
which compiles to the following error:
This doesn't use the full potential of the macro, as
t1
can be assigned a singleton type "Seq" in scala 2.13, or a witnessed type in scala < 2.13 using shapelessThe following works however in scala 2.13, not sure how:
The text was updated successfully, but these errors were encountered: