diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-12-10 12:19:43 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-12-10 12:19:43 -0800 |
commit | 84eff4d144e1523f1a51ffca77eb983a29eccd72 (patch) | |
tree | 09f26a6add77fa574a53c95b6814e62fd8a6bbc7 /src | |
parent | 6f121da8902ea0b7a778f1ae1e690490330ba2ca (diff) | |
parent | 8434922d6f0ead95a2109a5e41f4db4136449e93 (diff) | |
download | scala-84eff4d144e1523f1a51ffca77eb983a29eccd72.tar.gz scala-84eff4d144e1523f1a51ffca77eb983a29eccd72.tar.bz2 scala-84eff4d144e1523f1a51ffca77eb983a29eccd72.zip |
Merge pull request #1711 from retronym/ticket/1672
SI-1672 Catches are in tail position without finally.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/TailCalls.scala | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala index 95cb052fda..a767850cba 100644 --- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala +++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala @@ -327,8 +327,16 @@ abstract class TailCalls extends Transform { transformTrees(cases).asInstanceOf[List[CaseDef]] ) + case Try(block, catches, finalizer @ EmptyTree) => + // SI-1672 Catches are in tail position when there is no finalizer + treeCopy.Try(tree, + noTailTransform(block), + transformTrees(catches).asInstanceOf[List[CaseDef]], + EmptyTree + ) + case Try(block, catches, finalizer) => - // no calls inside a try are in tail position, but keep recursing for nested functions + // no calls inside a try are in tail position if there is a finalizer, but keep recursing for nested functions treeCopy.Try(tree, noTailTransform(block), noTailTransforms(catches).asInstanceOf[List[CaseDef]], |