Skip to content

Commit 7f9b524

Browse files
committed
Render different message depending on missingMethods count
1 parent e90f190 commit 7f9b524

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3671,11 +3671,15 @@ extends Message(ConcreteClassHasUnimplementedMethodsID):
36713671
})
36723672
}
36733673

3674-
def msg(using Context) =
3675-
s"""$clazz needs to be abstract, since it has ${missingMethods.size} unimplemented members.
3676-
|
3677-
|${renderMissingMethods.mkString("\n")}
3678-
|""".stripMargin
3674+
def msg(using Context) = missingMethods match
3675+
case single :: Nil =>
3676+
def showDclAndLocation(sym: Symbol) = s"${sym.showDcl} in ${sym.owner.showLocated}"
3677+
s"$clazz needs to be abstract, since ${showDclAndLocation(single)} is not defined"
3678+
case _ =>
3679+
s"""$clazz needs to be abstract, since it has ${missingMethods.size} unimplemented members.
3680+
|
3681+
|${renderMissingMethods.mkString("\n")}
3682+
|""".stripMargin
36793683

36803684
def explain(using Context) = ""
36813685
override def actions(using Context) = this.actions

0 commit comments

Comments
 (0)