I need Scala macros (reify, quasiquote, macro impl) for my Scala assertions library.
I want to be able to do this:
object1.assertEquals(object2) // success: object1 = object2
Or like this:
3.assertEquals(1 + 1) // failure: 1 + 1 /= 3
Can Scala macros be defined inside an implicit class?
The implementation has to be in an object or a macro bundle, but the method that is implemented by the macro can be in an implicit class. Notice
val self = q"${c.prefix}.self"that is needed to get the reference to the object that is wrapped by the implicit class.Usage: