From f23ff3abba8663a0e7f64f79b556efd36cc86a83 Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Thu, 29 Sep 2016 17:10:45 +0200 Subject: Improve positions for MemberDefs using `namePos` --- .../tools/dotc/reporting/diagnostic/messages.scala | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/dotty/tools/dotc/reporting/diagnostic/messages.scala') diff --git a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index 4553a2d22..14978449a 100644 --- a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -166,9 +166,22 @@ object messages { } } + case class CaseClassMissingParamList(cdef: untpd.TypeDef)(implicit ctx: Context) + extends Message(4) { + val kind = "Syntax" + val msg = + hl"""|A ${"case class"} must have at least one parameter list""" + + val explanation = + hl"""|${cdef.name} must have at least one parameter list, if you would rather + |have a singleton representation of ${cdef.name}, use a "${"case object"}". + |Or, add an explicit `()' as a parameter list to ${cdef.name}.""".stripMargin + } + + // Type Errors ------------------------------------------------------------ // case class DuplicateBind(bind: untpd.Bind, tree: untpd.CaseDef)(implicit ctx: Context) - extends Message(4) { + extends Message(5) { val kind = "Naming" val msg = em"duplicate pattern variable: `${bind.name}`" @@ -195,7 +208,7 @@ object messages { } case class MissingIdent(tree: untpd.Ident, treeKind: String, name: String)(implicit ctx: Context) - extends Message(5) { + extends Message(6) { val kind = "Missing Identifier" val msg = em"not found: $treeKind$name" @@ -206,7 +219,7 @@ object messages { } case class TypeMismatch(found: Type, expected: Type, whyNoMatch: String = "", implicitFailure: String = "")(implicit ctx: Context) - extends Message(6) { + extends Message(7) { val kind = "Type Mismatch" private val (where, printCtx) = Formatting.disambiguateTypes(found, expected) private val (fnd, exp) = Formatting.typeDiff(found, expected)(printCtx) -- cgit v1.2.3