Skip to content

Disallow curried dependent context function types #9303

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

Merged
merged 2 commits into from
Jul 7, 2020

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 6, 2020

We can't implement them yet. Better to disallow them outright than to try map them
to something wrong and have obscure follow-on errors.

Also: Implement returns in methods with context function result types

Previously, a return in a method with a CFT result type crashed the typer.

@odersky
Copy link
Contributor Author

odersky commented Jul 6, 2020

@nicolasstucki If you produce a new bootstrap compiler it would be good to have this PR in it as well. That would allow me to continue with my experiment to use CFTs in the compiler. Right now that's blocked since some methods that would have a CFT result type also have return statements.

Copy link
Contributor

@nicolasstucki nicolasstucki left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

.takeWhile(_.isAnonymousFunction)
.toList
.reverse
.map(_.paramSymss.head)
Copy link
Contributor

Choose a reason for hiding this comment

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

This map can be done before the toList

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but that's not necessarily better, or is it? We are talking of iterators of length 1 - 2 on average

Copy link
Contributor

Choose a reason for hiding this comment

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

Then the extra allocation should be fine.

@nicolasstucki nicolasstucki merged commit 2ca1165 into scala:master Jul 7, 2020
@nicolasstucki nicolasstucki deleted the fix-ift-return branch July 7, 2020 05:42
@nicolasstucki
Copy link
Contributor

This change will be available in the compiler once #9311 is merged.

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.

2 participants