-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
I get error when trying to derive JsonReader
for an enum that has opaque type field:
import tethys.*
import tethys.derivation.auto.*
import tethys.derivation.semiauto.*
object Id:
opaque type Id = Long
given JsonReader[Id] = tethys.JsonReader.longReader
object Id:
def apply(i: Long): Id = i
enum Foo(@selector val typ: String) derives JsonReader:
case Bar(id: Id.Id) extends Foo("foo")
-- [E007] Type Mismatch Error: -------------------------------------------------
1 |enum Foo(@selector val typ: String) derives JsonReader:
| ^
| Found: id
| Required: Id.Id
|----------------------------------------------------------------------------
|Inline stack trace
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|This location contains code that was inlined from rs$line$5:1
----------------------------------------------------------------------------
|
| longer explanation available when compiling with `-explain`
1 error found
And when Option[Id.Id]
is used everything is fine.
Metadata
Metadata
Assignees
Labels
No labels