Skip to content

Fix #2056: Backend crash when inlined method contains try #2059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions compiler/src/dotty/tools/dotc/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
13 changes: 13 additions & 0 deletions tests/pos/i2056.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
object Test {
inline def crash() = {
try {
println("hi")
} catch {
case e: Exception =>
}
}

def main(args: Array[String]): Unit = {
crash()
}
}