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

Incorrect error message when not specifying curryed vararg parameters #14567

Closed
anatoliykmetyuk opened this issue Feb 25, 2022 · 3 comments · Fixed by #14676
Closed

Incorrect error message when not specifying curryed vararg parameters #14567

anatoliykmetyuk opened this issue Feb 25, 2022 · 3 comments · Fixed by #14676
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug

Comments

@anatoliykmetyuk
Copy link
Contributor

Compiler version

3.1.1

Minimized code & Output

scala> case class Foo(x: Int)(xs: String*)
// defined case class Foo

scala> Foo(3)
-- [E081] Type Error: ----------------------------------------------------------
1 |Foo(3)
  |^
  |Missing parameter type
  |
  |I could not infer the type of the parameter xs.
1 error found

Expectation

Notify the user that the argument list for xs is mandatory instead of telling them that the type cannot be inferred.

@anatoliykmetyuk anatoliykmetyuk added itype:bug area:reporting Error reporting including formatting, implicit suggestions, etc labels Feb 25, 2022
@som-snytt
Copy link
Contributor

This was fixed recently

Welcome to Scala 3.1.3-RC1-bin-SNAPSHOT-git-2ecde3a (17.0.2, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> case class Foo(x: Int)(xs: String*)
// defined case class Foo

scala> Foo(42)
val res0: Seq[String] => Foo = Lambda$1509/0x000000080112c2b8@34f48d1

@nicolasstucki
Copy link
Contributor

This was fixed recently

Then we should add a regression test

@som-snytt
Copy link
Contributor

odersky added a commit to dotty-staging/dotty that referenced this issue Mar 12, 2022
nicolasstucki added a commit that referenced this issue Mar 14, 2022
Regression test to show that #14567 is fixed
odersky added a commit to dotty-staging/dotty that referenced this issue Feb 12, 2023
A unary varargs method sits between nullary methods that sometimes get a () argument inferred
(i.e. for methods coming from Java) and other methods that can be eta expanded. The safest
strategy for them is to do neither, and expect either an explicit expected function type,
or an explicit argument. That's also what Scala 2 does.

Fixes scala#16820

Reclassifies scala#14567 to be a neg test (with the error message suggested in the original issue
for scala#14567)
odersky added a commit that referenced this issue Feb 19, 2023
A unary varargs method sits between nullary methods that sometimes get a
() argument inferred (i.e. for methods coming from Java) and other
methods that can be eta expanded. The safest strategy for them is to do
neither, and expect either an explicit expected function type, or an
explicit argument. That's also what Scala 2 does.

Fixes #16820

Reclassifies #14567 to be a neg test (with the error message suggested
in the original issue for #14567)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants