Skip to content

Polymorphic function value not allowed depending on placement of braces #12323

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

Closed
jrudolph opened this issue May 4, 2021 · 3 comments · Fixed by #12331
Closed

Polymorphic function value not allowed depending on placement of braces #12323

jrudolph opened this issue May 4, 2021 · 3 comments · Fixed by #12331
Milestone

Comments

@jrudolph
Copy link
Contributor

jrudolph commented May 4, 2021

Seems to be a variation of #6725:

type X[T] = [U] => U => U

// These work:
val x1: X[Int] = [U] => (u: U) => u
val x2: X[Int] = [U] => ((u: U) => u)
val x3: X[Int] = [U] => (u: U) => { u }

// This one complains with "Implementation restriction: polymorphic function literals must have a value parameter"
val xe: X[Int] = [U] => { (u: U) => u }
@odersky
Copy link
Contributor

odersky commented May 5, 2021

We should get rid of that implementation restriction.

@jrudolph
Copy link
Contributor Author

jrudolph commented May 5, 2021

We should get rid of that implementation restriction.

It's not quite clear to me what the actual implementation restriction currently is? Is it that polymorphic function literals are not allowed to be nullary (aside from the type parameters)?

I opened a PR just to fix that syntax anomaly here: #12331. Maybe we should create a separate ticket for the functionality change?

jrudolph added a commit to jrudolph/dotty that referenced this issue May 5, 2021
@bishabosha
Copy link
Member

I opened a PR just to fix that syntax anomaly here: #12331. Maybe we should create a separate ticket for the functionality change?

I opened lampepfl/dotty-feature-requests#206

neko-kai pushed a commit to 7mind/dotty that referenced this issue May 5, 2021
@Kordyjan Kordyjan added this to the 3.0.1 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants