Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#20145 - bugfix when a return tail rec is called inside a val #20632

Closed
wants to merge 2 commits into from

Conversation

LucySMartin
Copy link

Fixes #20145
Prior to this fix, this test case threw a stack overflow of self calls, despite the @tailrec annotation.
Was simpler to have it work than have it error out.

@LucySMartin LucySMartin marked this pull request as draft June 19, 2024 16:28
…l definition, previously this would neither optimise nor fail.
@LucySMartin LucySMartin marked this pull request as ready for review June 19, 2024 16:30
…l definition, previously this would neither optimise nor fail.
@LucySMartin
Copy link
Author

I know I had this working at one point.
I know - don't try and rush things.

Feel free to ignore this for now, ill be more careful fixing it up...

}
}
@main def Test =
println(foo(0))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelatedly, you can assert(foo(0) == K) to avoid introducing a check file.

Also, a PR can be in "draft" mode to mean "not ready for review". If you accidentally push to your branch while a PR is closed, it doesn't let you re-open the PR (for some reason).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tail recursion from inside value defs
2 participants