Skip to content

[A] => ((x: A) => x) is not handled correctly #6725

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
smarter opened this issue Jun 21, 2019 · 0 comments
Closed

[A] => ((x: A) => x) is not handled correctly #6725

smarter opened this issue Jun 21, 2019 · 0 comments
Labels
area:desugar Desugaring happens after parsing but before typing, see desugar.scala itype:bug

Comments

@smarter
Copy link
Member

smarter commented Jun 21, 2019

It should be equivalent to [A] => (x: A) => x but instead we get an error:

scala> val id: [A] => A => A = [A] => (x: A) => x
val id: PolyFunction{apply: [A](x$1: A): A} = <function1>

scala> val id: [A] => A => A = [A] => ((x: A) => x)
1 |val id: [A] => A => A = [A] => ((x: A) => x)
  |                            ^
  |Implementation restriction: polymorphic function literals must have a value parameter
@smarter smarter added itype:bug area:desugar Desugaring happens after parsing but before typing, see desugar.scala labels Jun 21, 2019
smarter added a commit to dotty-staging/dotty that referenced this issue Jun 21, 2019
milessabin added a commit that referenced this issue Jun 22, 2019
Fix #6725: Parsing of poly function with parenthesized body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:desugar Desugaring happens after parsing but before typing, see desugar.scala itype:bug
Projects
None yet
Development

No branches or pull requests

1 participant