During Decoder/Codec derivation for ADT subclasses additional values declaration by indexes are using (here and here):
val (transformedNameNames: List[TermName], transformedNameDefs: List[Tree]) = subclassList.zipWithIndex.map {
case (s, i) =>
val name = TermName(s"name$i")
val value = transformName(nameOf(s))
(name, q"private[this] val $name = $value")
}.unzip
Despite that subclassList in both cases is defined as (here and here):
// We don't _really_ care about the order but want to be sure its stable here.
val subclassList: List[Symbol] = subclasses.toList
this implementation does not guarantee the same order (in fact, stable indexes) of such definitions between several compilations of the same code.
During
Decoder/Codecderivation for ADT subclasses additional values declaration by indexes are using (here and here):Despite that
subclassListin both cases is defined as (here and here):this implementation does not guarantee the same order (in fact, stable indexes) of such definitions between several compilations of the same code.