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 _ as a type lambda placeholder in -Ykind-projector:underscores compatiblity mode #12378

Merged
merged 1 commit into from May 10, 2021

Conversation

neko-kai
Copy link
Contributor

@neko-kai neko-kai commented May 7, 2021

Also allow through +_ and -_ only in that mode, these variance markers are ignored since we infer variance.

Fix partially #5379

Related issues and PRs: typelevel/kind-projector#120 typelevel/kind-projector#188 scala/scala#9605

note

What I did in Settings.scala to allow -Ykind-projector to parse without an argument is likely suboptimal, but at least it's a very small diff...

@neko-kai
Copy link
Contributor Author

neko-kai commented May 7, 2021

Note: #5379 is not fully addresssed because there is an unresolved question on what should F[_[_]] translate to.

SIP mentions that analogy with value-level placeholders is a reason to use _ for type lambdas as well.

However, in Scala 2 kind-projector will translate the above to [G[_]] =>> F[G], but a similar value-level lambda f(_(_)) will translate to f(g, a) => g(a)).

Therefore this change repurposes Ykind-projector machinery to allow cross-compilation with a subset of new syntax and leaves the above question to a future 'proper' implementation of the SIP.

…es` compatiblity mode

Also allow through `+_` and `-_` only in that mode, these variance markers are ignored since we infer variance.
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.

None yet

3 participants