summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-06-27 14:30:54 +0200
committerJason Zaugg <jzaugg@gmail.com>2014-06-27 14:30:54 +0200
commite5964e26fef818390694ecdd91e7fd1cad60b210 (patch)
tree937bf29334e4dee5e8af2424ca90c7ce4d456cce /src
parent44f10291622058d11d75dc8f3ad35b582247799c (diff)
parent299594e63a925c3e6042c6fd920de2f359417cbd (diff)
downloadscala-e5964e26fef818390694ecdd91e7fd1cad60b210.tar.gz
scala-e5964e26fef818390694ecdd91e7fd1cad60b210.tar.bz2
scala-e5964e26fef818390694ecdd91e7fd1cad60b210.zip
Merge pull request #3832 from jrudolph/w/fix-tailrec
SI-8657 don't miss tailrec defs in more positions
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/transform/TailCalls.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
index 714f189ead..d9d1192772 100644
--- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala
+++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
@@ -328,11 +328,14 @@ abstract class TailCalls extends Transform {
)
case CaseDef(pat, guard, body) =>
+ // CaseDefs are already translated and guards were moved into the body.
+ // If this was not the case, guards would have to be transformed here as well.
+ assert(guard.isEmpty)
deriveCaseDef(tree)(transform)
case If(cond, thenp, elsep) =>
treeCopy.If(tree,
- cond,
+ noTailTransform(cond),
transform(thenp),
transform(elsep)
)
@@ -363,7 +366,7 @@ abstract class TailCalls extends Transform {
rewriteApply(tapply, fun, targs, vargs)
case Apply(fun, args) if fun.symbol == Boolean_or || fun.symbol == Boolean_and =>
- treeCopy.Apply(tree, fun, transformTrees(args))
+ treeCopy.Apply(tree, noTailTransform(fun), transformTrees(args))
// this is to detect tailcalls in translated matches
// it's a one-argument call to a label that is in a tailposition and that looks like label(x) {x}