Skip to content

Add case class error message #5541

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

Merged

Conversation

OlivierBlanvillain
Copy link
Contributor

Add error message for case classes with a single implicit parameter list. Current it fails in an unfriendly way:

Starting dotty REPL...
scala> case class Foo(implicit i: Int)
     | 
1 |case class Foo(implicit i: Int)
  |^
  |too many arguments for constructor Foo: ()(implicit i: Int): Foo

Scalac is in my opinion unnecessarily nice in that case:

Welcome to Scala 2.12.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_161).
Type in expressions for evaluation. Or try :help.
scala> case class Foo(implicit i: Int)
<console>:11: warning: case classes should have a non-implicit parameter list; adapting to "case class Foo()(...)"
       case class Foo(implicit i: Int)
                     ^
defined class Foo

For case classes with a single implicit parameter list.
@odersky odersky merged commit 11ed751 into scala:master Dec 7, 2018
@allanrenucci allanrenucci deleted the case-class-with-implicit-parameter-list branch December 7, 2018 14:49
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.

3 participants