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
In the code below deriving JsonValueCodec[A] ends in a compilation error.
When definition of ReqId is changed to opaque type ReqId = Option[String], derivation succeeds.
objectWrappers {
opaquetypeReqId<:Option[String] =Option[String]
objectReqId {
inlinedefapply(x: Option[String]):ReqId= x
givenJsonValueCodec[ReqId] =JsonCodecMaker.make[Option[String]]
}
}
objectJsoniterOpaqueextendsApp {
importWrappers.*
println(writeToString(ReqId(None))) // null
println(readFromString[ReqId]("null")) // NonecaseclassA(r: ReqId)
/** Exception occurred while executing macro expansion.* java.util.NoSuchElementException: head of empty list*/// given JsonValueCodec[A] = JsonCodecMaker.make
}
The text was updated successfully, but these errors were encountered:
Opaque types are not supported yet and I suppose that a custom codec for ReqId cannot be summoned due to a known bug in the Scala 3 compiler: scala/scala3#21199
In the code below deriving
JsonValueCodec[A]
ends in a compilation error.When definition of
ReqId
is changed toopaque type ReqId = Option[String]
, derivation succeeds.The text was updated successfully, but these errors were encountered: