Suppose I've got two macro-annotated classes, and after their fields are defined during expansion, one depends on the other:
@Annotation
case class A(i: Int)
@Annotation
case class B(a: A)
I need A
to be expanded before B
, but the order of their definition does not ensure that.
For example, a reference to B
as a type-parameter to an object in an unrelated compilation unit, such as:
class X{val b = B(A(1))}
in one file and class Y{Z[B]}
in another,
causes B
to be expanded first and thus my compilation fails.
What determines the order of macro expansion in this case? Is there any way to enforce a desired order?
Thanks for your input,
Julian