@@ -3,7 +3,7 @@ package transform
3
3
4
4
import core ._
5
5
import MegaPhase ._
6
- import collection .mutable
6
+ import scala . collection .mutable
7
7
import SymDenotations ._ , Symbols ._ , Contexts ._ , Types ._ , Names ._ , StdNames ._ , NameOps ._
8
8
import ast .Trees ._
9
9
import util .Positions ._
@@ -636,7 +636,7 @@ object PatternMatcher {
636
636
}
637
637
override def hashCode : Int = tree.hash
638
638
}
639
- type SeenVars = Map [RHS , TermSymbol ]
639
+ type SeenVars = mutable. LinkedHashMap [RHS , TermSymbol ]
640
640
641
641
/** The variables known at entry to label */
642
642
val seenAtLabel = newMutableSymbolMap[SeenVars ]
@@ -664,15 +664,18 @@ object PatternMatcher {
664
664
665
665
override def apply (plan : LetPlan ): Plan = {
666
666
initializer(plan.sym) = apply(initializer(plan.sym))
667
- val seenVars1 =
667
+ val seenVars1 : SeenVars =
668
668
if (isPatmatGenerated(plan.sym)) {
669
669
val thisRhs = new RHS (initializer(plan.sym))
670
670
seenVars.get(thisRhs) match {
671
671
case Some (seen) =>
672
672
initializer(plan.sym) = ref(seen)
673
673
seenVars
674
674
case none =>
675
- seenVars.updated(thisRhs, plan.sym)
675
+ val seenVars1 : SeenVars = mutable.LinkedHashMap .empty
676
+ seenVars1 ++= seenVars
677
+ seenVars1(thisRhs) = plan.sym
678
+ seenVars1
676
679
}
677
680
}
678
681
else seenVars
@@ -685,7 +688,9 @@ object PatternMatcher {
685
688
plan.body = apply(plan.body)
686
689
val paramsMap = paramsOfLabel.getOrElse(plan.sym, Map ())
687
690
plan.params = paramsMap.values.toList.sortBy(_.name.toString)
688
- val seenVars1 = seenVars ++ paramsMap
691
+ val seenVars1 : SeenVars = mutable.LinkedHashMap .empty
692
+ seenVars1 ++= seenVars
693
+ seenVars1 ++= paramsMap
689
694
labelled(plan.sym) = new Merge (seenVars1)(labelled(plan.sym))
690
695
plan
691
696
}
@@ -709,7 +714,7 @@ object PatternMatcher {
709
714
else CallPlan (plan.label, newArgs)
710
715
}
711
716
}
712
- (new Merge (Map ()))(plan)
717
+ (new Merge (new mutable. LinkedHashMap ()))(plan)
713
718
}
714
719
715
720
/** Inline let-bound trees that are referenced only once.
0 commit comments