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

Allow return in tailrec position #14067

Merged
merged 2 commits into from
Jan 20, 2022
Merged

Conversation

mbovel
Copy link
Member

@mbovel mbovel commented Dec 7, 2021

Implement lampepfl/dotty-feature-requests#261.

Joint work with @ghostbuster91 in the framework of the issue spree.

@mbovel mbovel self-assigned this Dec 22, 2021
Copy link
Member

@sjrd sjrd left a comment

Choose a reason for hiding this comment

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

This shouldn't create any issues now.

However, to be complete, you'll have to actually recurse in all trees all the time. See this comment:
https://github.com/lampepfl/dotty/blob/a34977551e9e13090e6b5201f7d91879464f991c/compiler/src/dotty/tools/dotc/transform/TailRec.scala#L29-L31
Now any nested tree could contain a recursive call, which was not the case before.

Also, this will need more tests before it's ready to merge. ;)

@mbovel mbovel marked this pull request as ready for review December 30, 2021 18:44
Copy link
Member

@sjrd sjrd left a comment

Choose a reason for hiding this comment

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

Looks good to me.

There might be concerns about the performance impact, since now checking needs to be done everywhere all the time. So perhaps ask the performance bot?

@mbovel
Copy link
Member Author

mbovel commented Jan 3, 2022

test performance please

@dottybot
Copy link
Member

dottybot commented Jan 3, 2022

performance test scheduled: 1 job(s) in queue, 0 running.

@dottybot
Copy link
Member

dottybot commented Jan 3, 2022

Performance test finished successfully:

Visit https://dotty-bench.epfl.ch/14067/ to see the changes.

Benchmarks is based on merging with master (eb75a1a)

@mbovel
Copy link
Member Author

mbovel commented Jan 10, 2022

@sjrd could we merge this or do we need more changes or measurements?

Copy link
Member

@sjrd sjrd left a comment

Choose a reason for hiding this comment

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

The benchmark results look good to me. It's good to go as far as I'm concerned.

@mbovel mbovel merged commit 819c2ff into scala:master Jan 20, 2022
@mbovel mbovel deleted the return-tailrec branch January 20, 2022 10:22
Kordyjan added a commit to dotty-staging/dotty that referenced this pull request Mar 21, 2022
This reverts commit 4368847.
This reverts commit a349775.
Kordyjan added a commit that referenced this pull request Mar 22, 2022
Revert "Allow return in tailrec position" #14067
Kordyjan added a commit to dotty-staging/dotty that referenced this pull request Mar 22, 2022
This reverts commit 4368847.
This reverts commit a349775.
Kordyjan added a commit that referenced this pull request Mar 22, 2022
This was referenced Apr 14, 2022
Kordyjan added a commit that referenced this pull request Apr 20, 2022
@Kordyjan Kordyjan added this to the 3.1.2 milestone Aug 2, 2023
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.

4 participants