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

Polymorphic function parameter types not inferred #6892

Open
LPTK opened this issue Jul 19, 2019 · 3 comments
Open

Polymorphic function parameter types not inferred #6892

LPTK opened this issue Jul 19, 2019 · 3 comments

Comments

@LPTK
Copy link
Contributor

LPTK commented Jul 19, 2019

minimized code

val f: [A] => A => A = a => a

// same with:

val f: [A] => A => A = [A] => a => a

Weirdly, the error is reported as a "Syntax Error":

[error] -- [E081] Syntax Error: infer.scala:6:25 
[error] 6 |  val f: [A] => A => A = a => a
[error]   |                         ^
[error]   |                         Missing parameter type
[error]   |                         
[error]   |                         I could not infer the type of the parameter a.
[error] one error found
@smarter
Copy link
Member

smarter commented Jul 19, 2019

While the error message is weird, this is a feature request (which I'm planning to implement eventually) not a bug, so labelling it as such.

Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Dec 1, 2019
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Dec 1, 2019
The first was pointed out in scala#6892.
@Blaisorblade
Copy link
Contributor

Blaisorblade commented Dec 1, 2019

Weirdly, the error is reported as a "Syntax Error":

One-liner fix in #7654.

@Atry
Copy link
Contributor

Atry commented Jan 2, 2020

The inference will be extremely useful if it supports implicit parameters as well.

type F = [A, B] => quoted.Expr[_ <: A] => (given quoted.Type[A]) => B

val f: F = { a =>
  a
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants