summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2006-08-02 12:19:09 +0000
committerBurak Emir <emir@epfl.ch>2006-08-02 12:19:09 +0000
commit65c14d6dc774359d9c6c034ee66d868dc4d89d08 (patch)
tree24854fcefd08899f2f1588646e7117ce996cfa28
parent793151ef0740333b20759bdb3b90011b8d126367 (diff)
downloadscala-65c14d6dc774359d9c6c034ee66d868dc4d89d08.tar.gz
scala-65c14d6dc774359d9c6c034ee66d868dc4d89d08.tar.bz2
scala-65c14d6dc774359d9c6c034ee66d868dc4d89d08.zip
given that pattern matcher catches dead branches,
UnCurry must be more precise when adding cases that re-throw unmatched exceptions.
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index c640720635..e34a52db53 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -417,7 +417,14 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
else {
val exname = unit.fresh.newName("ex$")
val cases =
- if (catches exists treeInfo.isDefaultCase) catches
+ if ((catches exists treeInfo.isDefaultCase) || (catches.last match { // bq: handle try { } catch { ... case ex:Throwable => ...}
+ case CaseDef(Typed(Ident(nme.WILDCARD), tpt), EmptyTree, _) if (tpt.tpe =:= ThrowableClass.tpe) =>
+ true
+ case CaseDef(Bind(_, Typed(Ident(nme.WILDCARD), tpt)), EmptyTree, _) if (tpt.tpe =:= ThrowableClass.tpe) =>
+ true
+ case _ =>
+ false
+ })) catches
else catches ::: List(CaseDef(Ident(nme.WILDCARD), EmptyTree, Throw(Ident(exname))));
val catchall =
atPos(tree.pos) {