Skip to content

Various fixes for implicit/erased function types #4128

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 4 commits into from
Mar 17, 2018

Conversation

smarter
Copy link
Member

@smarter smarter commented Mar 16, 2018

No description provided.

In `typedDependent` we used to desugar the type `implicit (x: HasT) => x.T` to:

     ImplicitFunction1[HasT, HasT#T] { def apply(x: HasT): x.T }

This commit sets the implicit/erased modifiers on all parameters of an
implicit/erased function type, this changes the desugaring to the more correct:

     ImplicitFunction1[HasT, HasT#T] { def apply(implicit x: HasT): x.T }
@smarter smarter force-pushed the fix/implicit-erased-funs branch 2 times, most recently from 6bd6bf5 to 303f6d2 Compare March 16, 2018 16:46
@smarter smarter requested a review from odersky March 16, 2018 16:47
@smarter smarter force-pushed the fix/implicit-erased-funs branch from 303f6d2 to a0f4afb Compare March 16, 2018 17:24
smarter added 3 commits March 16, 2018 20:10
Previously, the implicit/erased flags were lost.

The tag used for METHODtype was changed to make the encoding of the
implicit/erased flags more convenient, this requires a major TASTY bump.
@smarter smarter force-pushed the fix/implicit-erased-funs branch from a0f4afb to f66660a Compare March 16, 2018 19:10

// In binary: 101100EI
// I = implicit method type
// E = erased method type
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing test case? I did not see a test where a refinement had implicit or erased parameters. In fact, I am not sure we even want to support this. If we don't support it, we won't need to complicate the TASTY format. Compared to the rest of the format, which is rather lean, this does stick out like a sore thumb.

Copy link
Member Author

Choose a reason for hiding this comment

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

https://github.com/dotty-staging/dotty/blob/f66660a590cb488a4ea817dbcd0a5f8f49d68df9/tests/pos/implicit-dep.scala is a testcase for an implicit dependent function type, which ends up being desugared to a refinement with an implicit method

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Seems we have to support this then!

@smarter smarter merged commit ff96e56 into scala:master Mar 17, 2018
@Blaisorblade Blaisorblade deleted the fix/implicit-erased-funs branch March 18, 2018 14:05
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