Skip to content

Commit 48c2c3e

Browse files
authored
ADT leafs should be also ordered by name to support external symbols (#1270)
1 parent d06534d commit 48c2c3e

File tree

1 file changed

+1
-12
lines changed
  • jsoniter-scala-macros/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/macros

1 file changed

+1
-12
lines changed

jsoniter-scala-macros/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodecMaker.scala

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -606,17 +606,6 @@ object JsonCodecMaker {
606606
import c.universe._
607607
import c.internal._
608608

609-
implicit val positionOrdering: Ordering[c.universe.Position] =
610-
(x: c.universe.Position, y: c.universe.Position) => {
611-
val ax = x.source.file.absolute
612-
val ay = y.source.file.absolute
613-
var diff = ax.path.compareTo(ay.path)
614-
if (diff == 0) diff = ax.name.compareTo(ay.name)
615-
if (diff == 0) diff = x.line.compareTo(y.line)
616-
if (diff == 0) diff = x.column.compareTo(y.column)
617-
diff
618-
}
619-
620609
def fail(msg: String): Nothing = c.abort(c.enclosingPosition, msg)
621610

622611
def warn(msg: String): Unit = c.warning(c.enclosingPosition, msg)
@@ -900,7 +889,7 @@ object JsonCodecMaker {
900889
def adtLeafClasses(adtBaseTpe: Type): Seq[Type] = {
901890
def collectRecursively(tpe: Type): Seq[Type] = {
902891
val tpeClass = tpe.typeSymbol.asClass
903-
val leafTpes = tpeClass.knownDirectSubclasses.toSeq.sortBy(_.pos).flatMap { s =>
892+
val leafTpes = tpeClass.knownDirectSubclasses.toSeq.sortBy(_.fullName).flatMap { s =>
904893
val classSymbol = s.asClass
905894
val typeParams = classSymbol.typeParams
906895
val subTpe =

0 commit comments

Comments
 (0)