-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#20145 - bugfix when a return tail recurse is called inside a val def…
…inition, previously this would neither optimise nor fail.
- Loading branch information
Lucy Martin
committed
Jun 20, 2024
1 parent
eb2ea26
commit 036b86b
Showing
3 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10000001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import scala.annotation.tailrec | ||
@tailrec | ||
def foo(i: Int): Int = { | ||
if (i > 10000000) { | ||
i | ||
} else { | ||
val bar: String = { | ||
return foo(i + 1) | ||
"foo" | ||
} | ||
-1 | ||
} | ||
} | ||
@main def Test = | ||
println(foo(0)) |