File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -430,8 +430,8 @@ class TailRec extends MiniPhase {
430
430
tree
431
431
432
432
case tree : ValDef =>
433
- if (isMandatory) noTailTransform(tree.rhs)
434
- tree
433
+ // This could contain a return statement in a code block, so we do have to go into it.
434
+ cpy. ValDef ( tree)(rhs = noTailTransform(tree.rhs))
435
435
436
436
case tree : DefDef =>
437
437
if (isMandatory)
Original file line number Diff line number Diff line change
1
+ 10000001
Original file line number Diff line number Diff line change
1
+ import scala .annotation .tailrec
2
+ @ tailrec
3
+ def foo (i : Int ): Int = {
4
+ if (i > 10000000 ) {
5
+ i
6
+ } else {
7
+ val bar : String = {
8
+ return foo(i + 1 )
9
+ " foo"
10
+ }
11
+ - 1
12
+ }
13
+ }
14
+ @ main def Test =
15
+ println(foo(0 ))
You can’t perform that action at this time.
0 commit comments