I was debugging some code related to Scala macros.
m
is a def macro, which takes a function as its parameter:
def m(f: T => Boolean) = macro xxx
There is another function g: T => Boolean
. I found different behaviors by passing different lambda expressions to m
:
(x: T) => g(x)
(x: T) => (() => g(x))()
Is there a proper way to debug such cases? If I'm not mistaken, the parameters are expanded to AST and passed to the macro at compile time. How can I debug the compiled AST?