Skip to content

Commit 458ee55

Browse files
committed
Clean up message signatures
1 parent 2cef386 commit 458ee55

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,6 @@ object messages {
11941194
extends Message(SuperQualMustBeParentID) {
11951195

11961196
val msg = hl"""|$qual does not name a parent of $cls"""
1197-
11981197
val kind = "Reference"
11991198

12001199
private val parents: Seq[String] = (cls.info.parents map (_.name.show)).sorted
@@ -1209,15 +1208,13 @@ object messages {
12091208
}
12101209

12111210
case class VarArgsParamMustComeLast()(implicit ctx: Context)
1212-
extends Message(IncorrectRepeatedParameterSyntaxID) {
1213-
override def msg: String = "varargs parameter must come last"
1214-
1215-
override def kind: String = "Syntax"
1216-
1217-
override def explanation: String =
1211+
extends Message(IncorrectRepeatedParameterSyntaxID) {
1212+
val msg = "varargs parameter must come last"
1213+
val kind = "Syntax"
1214+
val explanation =
12181215
hl"""|The varargs field must be the last field in the method signature.
12191216
|Attempting to define a field in a method signature after a varargs field is an error.
1220-
|""".stripMargin
1217+
|"""
12211218
}
12221219

12231220
case class AmbiguousImport(name: Names.Name, newPrec: Int, prevPrec: Int, prevCtx: Context)(implicit ctx: Context)
@@ -1259,20 +1256,18 @@ object messages {
12591256
implicit ctx: Context)
12601257
extends Message(AmbiguousOverloadID) {
12611258

1262-
private def all = if (alts.length == 2) "both" else "all"
1263-
1264-
override def msg: String =
1259+
private val all = if (alts.length == 2) "both" else "all"
1260+
val msg =
12651261
s"""|Ambiguous overload. The ${err.overloadedAltsStr(alts)}
12661262
|$all match ${err.expectedTypeStr(pt)}""".stripMargin
1267-
1268-
override def kind: String = "Reference"
1269-
1270-
override def explanation: String =
1271-
s"""|There are ${alts.length} methods that could be referenced as the compiler knows too little about the expected type.
1263+
val kind = "Reference"
1264+
val explanation =
1265+
hl"""|There are ${alts.length} methods that could be referenced as the compiler knows too little
1266+
|about the expected type.
12721267
|You may specify the expected type e.g. by
12731268
|- assigning it to a value with a specified type, or
1274-
|- adding a type ascription as in `(instance.myMethod: String => Int)`
1275-
|""".stripMargin
1269+
|- adding a type ascription as in `${"instance.myMethod: String => Int"}`
1270+
|"""
12761271
}
12771272

12781273
}

0 commit comments

Comments
 (0)