Skip to content

Commit 90c2a37

Browse files
committed
Make macroDependencies compilation-order independent
Using a Set risks giving different results in different runs.
1 parent 6f21c72 commit 90c2a37

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/typer/Inliner.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,13 +1276,13 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
12761276
* This corresponds to the symbols that will need to be interpreted.
12771277
*/
12781278
private def macroDependencies(tree: Tree)(implicit ctx: Context) =
1279-
new TreeAccumulator[Set[Symbol]] {
1279+
new TreeAccumulator[List[Symbol]] {
12801280
private[this] var level = -1
1281-
override def apply(syms: Set[Symbol], tree: tpd.Tree)(implicit ctx: Context): Set[Symbol] =
1281+
override def apply(syms: List[Symbol], tree: tpd.Tree)(implicit ctx: Context): List[Symbol] =
12821282
if (level != -1) foldOver(syms, tree)
12831283
else tree match {
12841284
case tree: RefTree if level == -1 && tree.symbol.isDefinedInCurrentRun && !tree.symbol.isLocal =>
1285-
foldOver(syms + tree.symbol, tree)
1285+
foldOver(tree.symbol :: syms, tree)
12861286
case Quoted(body) =>
12871287
level += 1
12881288
try apply(syms, body)
@@ -1294,6 +1294,6 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
12941294
case _ =>
12951295
foldOver(syms, tree)
12961296
}
1297-
}.apply(Set.empty, tree)
1297+
}.apply(Nil, tree)
12981298
}
12991299

0 commit comments

Comments
 (0)