From 8994da9da0b57d24d632f4eab2cd8c17c530f279 Mon Sep 17 00:00:00 2001 From: Denys Shabalin Date: Thu, 6 Feb 2014 15:20:37 +0100 Subject: Fix inconsistent binding in patterns with 10+ holes Previously a map that was storing bindings of fresh hole variables with their contents (tree & cardinality) used to be a SortedMap which had issues with inconsistent key ordering: "$fresh$prefix$1" < "$fresh$prefix$2" ... "$fresh$prefix$8" < "$fresh$prefix$9" "$fresh$prefix$9" > "$fresh$prefix$10" This issue is solved by using a LinkedHashMap instead (keys are inserted in the proper order.) --- test/files/scalacheck/quasiquotes/TermConstructionProps.scala | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/files') diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala index 54187d68c2..145e51ab68 100644 --- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala @@ -291,4 +291,9 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") { val stats2 = List.empty[Tree] assert(q"{ ..$stats2 }" ≈ q"") } + + property("consistent variable order") = test { + val q"$a = $b = $c = $d = $e = $f = $g = $h = $k = $l" = q"a = b = c = d = e = f = g = h = k = l" + assert(a ≈ q"a" && b ≈ q"b" && c ≈ q"c" && d ≈ q"d" && e ≈ q"e" && g ≈ q"g" && h ≈ q"h" && k ≈ q"k" && l ≈ q"l") + } } -- cgit v1.2.3