File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -276,7 +276,7 @@ class TailRec extends MiniPhase {
276276 case tree@ Apply (fun, args) =>
277277 val meth = fun.symbol
278278 if (meth == defn.Boolean_|| || meth == defn.Boolean_&& )
279- tpd.cpy.Apply (tree)(fun, transform(args))
279+ tpd.cpy.Apply (tree)(noTailTransform( fun) , transform(args))
280280 else
281281 rewriteApply(tree)
282282
Original file line number Diff line number Diff line change 1+ import annotation .tailrec
2+
3+ class Test {
4+ def cond : Boolean = ???
5+
6+ @ tailrec final def tailCall1 (x : Int ): Boolean =
7+ if (x < 0 ) tailCall1(0 )
8+ else tailCall1(x - 1 ) || cond // error
9+
10+ @ tailrec final def tailCall2 (x : Int ): Boolean =
11+ if (x < 0 ) tailCall2(0 )
12+ else tailCall2(x - 1 ) && cond // error
13+
14+ @ tailrec final def tailCall3 (x : Int ): Boolean =
15+ if (x < 0 ) tailCall3(0 )
16+ else cond || tailCall3(x - 1 )
17+
18+ @ tailrec final def tailCall4 (x : Int ): Boolean =
19+ if (x < 0 ) tailCall4(0 )
20+ else cond && tailCall4(x - 1 )
21+ }
You can’t perform that action at this time.
0 commit comments