I have an implicit macro with a greedy signature
implicit def materializeHelper[C <: Any]: Helper[C] = macro materializeHelperImpl[C]
def materializeHelperImpl[C <: Any: ctx.WeakTypeTag](ctx: blackbox.Context): ctx.Expr[Helper[C]] = ???
According to it's signature it would materialize a Helper[C] for any C. But the body is much more picky. It only accepts Cs which are sealed traits.
What should the macro return to tell the compiler "forget my result, continue your implicit search as if I didn't exist"?
Currently I am returning an empty block (q""), which is not ideal because the compiler materializes a null when said implicit is used as an intermediate rule. For example, in the following line, the helper parameter is set to null when the macro returns empty (q"").
implicit def parser[C <: Any](implicit helper: Helper[C]): Parser[C] = new Parser[C](helper)
And my intention is that, in the case that C is not a sealed trait, the compiler discards both beforementioned implicit and continue the search for another more specific implicit value.