Skip to content

Commit 1a6cf58

Browse files
committed
Clean up message signatures
1 parent c6abd4e commit 1a6cf58

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
@@ -1199,7 +1199,6 @@ object messages {
11991199
extends Message(SuperQualMustBeParentID) {
12001200

12011201
val msg = hl"""|$qual does not name a parent of $cls"""
1202-
12031202
val kind = "Reference"
12041203

12051204
private val parents: Seq[String] = (cls.info.parents map (_.name.show)).sorted
@@ -1214,36 +1213,32 @@ object messages {
12141213
}
12151214

12161215
case class VarArgsParamMustComeLast()(implicit ctx: Context)
1217-
extends Message(IncorrectRepeatedParameterSyntaxID) {
1218-
override def msg: String = "varargs parameter must come last"
1219-
1220-
override def kind: String = "Syntax"
1221-
1222-
override def explanation: String =
1216+
extends Message(IncorrectRepeatedParameterSyntaxID) {
1217+
val msg = "varargs parameter must come last"
1218+
val kind = "Syntax"
1219+
val explanation =
12231220
hl"""|The varargs field must be the last field in the method signature.
12241221
|Attempting to define a field in a method signature after a varargs field is an error.
1225-
|""".stripMargin
1222+
|"""
12261223
}
12271224

12281225
case class AmbiguousOverload(tree: tpd.Tree, alts: List[SingleDenotation], pt: Type)(
12291226
err: typer.ErrorReporting.Errors)(
12301227
implicit ctx: Context)
12311228
extends Message(AmbiguousOverloadID) {
12321229

1233-
private def all = if (alts.length == 2) "both" else "all"
1234-
1235-
override def msg: String =
1230+
private val all = if (alts.length == 2) "both" else "all"
1231+
val msg =
12361232
s"""|Ambiguous overload. The ${err.overloadedAltsStr(alts)}
12371233
|$all match ${err.expectedTypeStr(pt)}""".stripMargin
1238-
1239-
override def kind: String = "Reference"
1240-
1241-
override def explanation: String =
1242-
s"""|There are ${alts.length} methods that could be referenced as the compiler knows too little about the expected type.
1234+
val kind = "Reference"
1235+
val explanation =
1236+
hl"""|There are ${alts.length} methods that could be referenced as the compiler knows too little
1237+
|about the expected type.
12431238
|You may specify the expected type e.g. by
12441239
|- assigning it to a value with a specified type, or
1245-
|- adding a type ascription as in `(instance.myMethod: String => Int)`
1246-
|""".stripMargin
1240+
|- adding a type ascription as in `${"instance.myMethod: String => Int"}`
1241+
|"""
12471242
}
12481243

12491244
}

0 commit comments

Comments
 (0)