tuned Markup_Tree.+ : slightly more expensive version to rebuild rest avoids crash of RedBlack.scala:120 (version Scala 2.8.0), e.g. on the following input:
authorwenzelm
Sun, 22 Aug 2010 22:28:24 +0200
changeset 38584 9f63135f3cbb
parent 38583 ff7f9510b0d6
child 38633 39412530436f
tuned Markup_Tree.+ : slightly more expensive version to rebuild rest avoids crash of RedBlack.scala:120 (version Scala 2.8.0), e.g. on the following input: ML {* fun f x = (x + 1, "aaa") *}
src/Pure/PIDE/markup_tree.scala
--- a/src/Pure/PIDE/markup_tree.scala	Sun Aug 22 22:09:14 2010 +0200
+++ b/src/Pure/PIDE/markup_tree.scala	Sun Aug 22 22:28:24 2010 +0200
@@ -72,7 +72,8 @@
         else {
           val body = Branches.overlapping(new_range, branches)
           if (body.forall(e => new_range.contains(e._1))) {
-            val rest = (branches /: body) { case (bs, (e, _)) => bs - e }
+            val rest = (Branches.empty /: branches)((rest, entry) =>
+              if (body.isDefinedAt(entry._1)) rest else rest + entry)
             new Markup_Tree(Branches.update(rest, new_info -> new Markup_Tree(body)))
           }
           else { // FIXME split markup!?