Skip to content

Disallow inline methods and opaque types in same scope #6853

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 5 commits into from
Jul 15, 2019

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 15, 2019

It looks extraordinarily hard to me to mix opaque types and inline methods. Combining inline methods with private members was already hard, see PrepareInlineable.scala which deals with this. Combining
inline methods with opaque types will be much harder. Quoting from #6846:

We cannot simply move
code compiled inside an opaque alias scope to outside this scope. The compiler can try to insert
some casts to make it work, but I see no general proven way to do so, because opaque types are
explained through type abstraction instead of through implicit conversions.

My current guess is that I'd need 2-4 weeks of full time work to arrive at a conclusion whether it's possible or not (I already spent 3 full days to arrive at this conclusion). But I don't have the time to do this. So it's safer we forbid this combination in an implementation restriction.

This PR also integrates the bits from #6846 that were worth salvaging.

@odersky odersky force-pushed the fix-inline-opaque-2 branch from 0de6a4b to f8dded5 Compare July 15, 2019 13:14
@odersky odersky merged commit e579bfa into scala:master Jul 15, 2019
@allanrenucci allanrenucci deleted the fix-inline-opaque-2 branch July 15, 2019 15:54
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