ReactiveMongo/ReactiveMongo-BSON

Check Macros with sealed family

cchantep opened this issue · 0 comments

Case members of trait not at the same level:

sealed trait Foo

object Foo {
  case object Bar extends Foo
  case object Lorem extends Foo
}

import reactivemongo.api.bson._

val h = Macros.handlerOpts[Foo, MacroOptions.Verbose]

h.writeTry(Foo.Bar).foreach { v =>
  println(BSONValue pretty v)
}

Error

Whereas:

sealed trait Foo
case object Bar extends Foo
case object Lorem extends Foo

import reactivemongo.bson.Macros

val h = Macros.handlerOpts[Foo, Macros.Options.AllImplementations]

h.write(Bar)
h.write(Lorem)