From 128df4d9542312f154d6a14e485bf873379b2e01 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Fri, 26 Apr 2019 16:47:10 +1000 Subject: [PATCH] Make macro produce determistic output for sealed subclasses `.decls` is documented as having unspecified order. (In practice, it the order reverses when called on previous compiled vs jointly compiled types) This commit follow the instructions in `.decls` ScalaDoc and calls `.sorted`. Here's an example of the non-deterministic output I'm trying to quash. --- .../shared/src/main/scala/play/api/libs/json/JsMacroImpl.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/play-json/shared/src/main/scala/play/api/libs/json/JsMacroImpl.scala b/play-json/shared/src/main/scala/play/api/libs/json/JsMacroImpl.scala index 413b8ccad..60798aba5 100644 --- a/play-json/shared/src/main/scala/play/api/libs/json/JsMacroImpl.scala +++ b/play-json/shared/src/main/scala/play/api/libs/json/JsMacroImpl.scala @@ -559,7 +559,7 @@ import scala.reflect.macros.blackbox } if (tpeSym.isSealed && tpeSym.isAbstract) { - Some(allSubclasses(tpeSym.owner.typeSignature.decls, Set.empty).toList) + Some(allSubclasses(tpeSym.owner.typeSignature.decls.sorted, Set.empty).toList) } else None }