Skip to content

Commit 4302b8a

Browse files
committed
WIP stabilize annotation ordering
1 parent 7e1f4f7 commit 4302b8a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/compiler/scala/tools/nsc/typechecker/RefChecks.scala

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,11 +1436,14 @@ abstract class RefChecks extends Transform {
14361436
checkTypeRefBounds(ann.tpe, tree)
14371437
}
14381438

1439-
annots
1440-
.map(_.transformArgs(transformTrees))
1441-
.groupBy(_.symbol)
1442-
.flatMap((groupRepeatableAnnotations _).tupled)
1443-
.toList
1439+
val annotsBySymbol = new mutable.LinkedHashMap[Symbol, ListBuffer[AnnotationInfo]]()
1440+
val transformedAnnots = annots.map(_.transformArgs(transformTrees))
1441+
for (transformedAnnot <- transformedAnnots) {
1442+
val buffer = annotsBySymbol.getOrElseUpdate(transformedAnnot.symbol, new ListBuffer)
1443+
buffer += transformedAnnot
1444+
}
1445+
val result = annotsBySymbol.iterator.flatMap(x => groupRepeatableAnnotations(x._1, x._2.toList)).toList
1446+
result
14441447
}
14451448

14461449
// assumes non-empty `anns`

0 commit comments

Comments
 (0)