From c373e682996c4ccff0ec072feb6a7bb26f6ef71e Mon Sep 17 00:00:00 2001 From: cgccuser <91574512+cgccuser@users.noreply.github.com> Date: Sun, 5 Jun 2022 18:31:32 -0400 Subject: [PATCH 1/2] Case class must have at least one *leading* non-implicit parameter list Closes #15202. Changes the message for case classes like `case class Foo(using Bar)(x: Baz)` from `Foo must have at least one non-implicit parameter list` to `must have at least one leading non-implicit parameter list`. --- compiler/src/dotty/tools/dotc/reporting/messages.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/reporting/messages.scala b/compiler/src/dotty/tools/dotc/reporting/messages.scala index aa233b62c784..66ac95098ce8 100644 --- a/compiler/src/dotty/tools/dotc/reporting/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/messages.scala @@ -2344,10 +2344,10 @@ import transform.SymUtils._ class CaseClassMissingNonImplicitParamList(cdef: untpd.TypeDef)(using Context) extends SyntaxMsg(CaseClassMissingNonImplicitParamListID) { def msg = - em"""|A ${hl("case class")} must have at least one non-implicit parameter list""" + em"""|A ${hl("case class")} must have at least one leading non-implicit parameter list""" def explain = - em"""|${cdef.name} must have at least one non-implicit parameter list, + em"""|${cdef.name} must have at least one leading non-implicit parameter list, | if you're aiming to have a case class parametrized only by implicit ones, you should | add an explicit ${hl("()")} as a parameter list to ${cdef.name}.""".stripMargin } From 16b694df75706182159fab89103817666b6b88d1 Mon Sep 17 00:00:00 2001 From: cgccuser <91574512+cgccuser@users.noreply.github.com> Date: Mon, 6 Jun 2022 10:38:51 -0400 Subject: [PATCH 2/2] Update compiler/src/dotty/tools/dotc/reporting/messages.scala MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michał Pałka --- compiler/src/dotty/tools/dotc/reporting/messages.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/reporting/messages.scala b/compiler/src/dotty/tools/dotc/reporting/messages.scala index 66ac95098ce8..a424ddf6927e 100644 --- a/compiler/src/dotty/tools/dotc/reporting/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/messages.scala @@ -2349,7 +2349,7 @@ import transform.SymUtils._ def explain = em"""|${cdef.name} must have at least one leading non-implicit parameter list, | if you're aiming to have a case class parametrized only by implicit ones, you should - | add an explicit ${hl("()")} as a parameter list to ${cdef.name}.""".stripMargin + | add an explicit ${hl("()")} as the first parameter list to ${cdef.name}.""".stripMargin } class EnumerationsShouldNotBeEmpty(cdef: untpd.TypeDef)(using Context)