sealedInstancesOf macro and getting declared enums in declaration order

Hi, I’m using a variant of this:
but returning a List:


But when called like this:

val values = sealedInstancesOf[EmailAddressLabel]

I’m not getting them in declaration-order.

Any ideas of how to get them in declaration-order?

Sorting by the position of the symbol sounds plausible.

I’ve tried sorting by:

val children = symbol.knownDirectSubclasses.toList.sortBy(_.pos.line)

But it doesn’t produce the ordering of declaration.
Any hints?

That’s odd. Make sure you’re seeing what you think you’re seeing and sprinkle liberally with debugging printlns

Hm, I must have recompiled only the macro and not the call-site. Recompiling all works.