sealedInstancesOf macro and getting declared enums in declaration order

Hi, I’m using a variant of this: https://github.com/d6y/enumeration-examples/blob/master/macros/src/main/scala/EnumerationMacros.scala
but returning a List:

Apply(
	Select(
		reify(List).tree,
		TermName("apply")
	),
	children.map(sourceModuleRef(_))
)

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.
Thanks!!