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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler/src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ object desugar {
if (isCaseClass && originalTparams.isEmpty)
ctx.error(CaseClassMissingParamList(cdef), cdef.namePos)
ListOfNil
} else if (isCaseClass && originalVparamss.head.exists(_.mods.is(Implicit))) {
ctx.error("Case classes should have a non-implicit parameter list", cdef.namePos)
ListOfNil
}
else originalVparamss.nestedMap(toDefParam)
val constr = cpy.DefDef(constr1)(tparams = constrTparams, vparamss = constrVparamss)
Expand Down
1 change: 1 addition & 0 deletions tests/neg/5541.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
case class Foo(implicit i: Int) // error: Case classes should have a non-implicit parameter list