aboutsummaryrefslogtreecommitdiff
path: root/compiler/src
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2017-03-07 13:58:31 +0100
committerGitHub <noreply@github.com>2017-03-07 13:58:31 +0100
commitbade85e43b3213af752cb1eed52190cb8569feb6 (patch)
tree5dc70900e50ca2ff672bf3148d6f9684d425d6c8 /compiler/src
parentc90ea6b62de5d70f8855b377688f62c40dfe3a66 (diff)
parent094cd9ff3b07536f75f3a233606823ae5478d542 (diff)
downloaddotty-bade85e43b3213af752cb1eed52190cb8569feb6.tar.gz
dotty-bade85e43b3213af752cb1eed52190cb8569feb6.tar.bz2
dotty-bade85e43b3213af752cb1eed52190cb8569feb6.zip
Merge pull request #2059 from dotty-staging/fix/inline-EmptyTree
Fix #2056: Backend crash when inlined method contains try
Diffstat (limited to 'compiler/src')
-rw-r--r--compiler/src/dotty/tools/dotc/ast/Trees.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/ast/Trees.scala b/compiler/src/dotty/tools/dotc/ast/Trees.scala
index 27be8c9d6..669e5429c 100644
--- a/compiler/src/dotty/tools/dotc/ast/Trees.scala
+++ b/compiler/src/dotty/tools/dotc/ast/Trees.scala
@@ -712,8 +712,11 @@ object Trees {
override def toList: List[Tree[T]] = flatten(trees)
override def toString = if (isEmpty) "EmptyTree" else "Thicket(" + trees.mkString(", ") + ")"
override def withPos(pos: Position): this.type = {
- val newTrees = trees.map(_.withPos(pos))
- new Thicket[T](newTrees).asInstanceOf[this.type]
+ val newTrees = trees.mapConserve(_.withPos(pos))
+ if (trees eq newTrees)
+ this
+ else
+ new Thicket[T](newTrees).asInstanceOf[this.type]
}
override def pos = (NoPosition /: trees) ((pos, t) => pos union t.pos)
override def foreachInThicket(op: Tree[T] => Unit): Unit =