Permalink
Browse files

Fix for SI-6154, VerifyError originating in uncurry.

Lhs still might be an Ident.  Miguel did all the work,
I just wrote it down in code form.
  • Loading branch information...
1 parent 3aba55a commit 48f8235822a2a100d6c4e8d3d7349df565ac6d40 @paulp paulp committed Jul 30, 2012
Showing with 15 additions and 4 deletions.
  1. +4 −4 src/compiler/scala/tools/nsc/transform/UnCurry.scala
  2. +1 −0 test/files/run/t6154.check
  3. +10 −0 test/files/run/t6154.scala
@@ -35,8 +35,8 @@ import language.postfixOps
* - convert non-local returns to throws with enclosing try statements.
* - convert try-catch expressions in contexts where there might be values on the stack to
* a local method and a call to it (since an exception empties the evaluation stack):
- *
- * meth(x_1,..., try { x_i } catch { ..}, .. x_b0) ==>
+ *
+ * meth(x_1,..., try { x_i } catch { ..}, .. x_b0) ==>
* {
* def liftedTry$1 = try { x_i } catch { .. }
* meth(x_1, .., liftedTry$1(), .. )
@@ -632,7 +632,7 @@ abstract class UnCurry extends InfoTransform
treeCopy.Apply(tree, transform(fn), transformTrees(transformArgs(tree.pos, fn.symbol, args, formals)))
}
- case Assign(Select(_, _), _) =>
+ case Assign(_: RefTree, _) =>
withNeedLift(true) { super.transform(tree) }
case Assign(lhs, _) if lhs.symbol.owner != currentMethod || lhs.symbol.hasFlag(LAZY | ACCESSOR) =>
@@ -641,7 +641,7 @@ abstract class UnCurry extends InfoTransform
case ret @ Return(_) if (isNonLocalReturn(ret)) =>
withNeedLift(true) { super.transform(ret) }
- case Try(_, Nil, _) =>
+ case Try(_, Nil, _) =>
// try-finally does not need lifting: lifting is needed only for try-catch
// expressions that are evaluated in a context where the stack might not be empty.
// `finally` does not attempt to continue evaluation after an exception, so the fact
@@ -0,0 +1 @@
+ok
View
@@ -0,0 +1,10 @@
+object Test {
+ def foo(a: Int) {
+ var bar: Int = 0
+ bar = try { 0 } catch { case ex: Throwable => 0 }
+ new { foo(bar) }
+ }
+
+ def main(args: Array[String]): Unit =
+ try foo(0) catch { case _: java.lang.StackOverflowError => println("ok") }
+}

0 comments on commit 48f8235

Please sign in to comment.