Skip to content

Commit 2427008

Browse files
committed
MissingIdent: take a Name instead of a String
Let the class itself worry about how to display that name, and means we can compare that name in `saysNotFound` without having to convert it to a String.
1 parent b52748e commit 2427008

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ object messages {
279279
}
280280
}
281281

282-
case class MissingIdent(tree: untpd.Ident, treeKind: String, name: String)(implicit ctx: Context)
282+
case class MissingIdent(tree: untpd.Ident, treeKind: String, name: Name)(implicit ctx: Context)
283283
extends Message(MissingIdentID) {
284284
val kind: String = "Unbound Identifier"
285285
val msg: String = em"Not found: $treeKind$name"

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ trait Applications extends Compatibility {
10681068
case NotAMember(_, name, _, _) =>
10691069
memberName.isEmpty || name == memberName
10701070
case MissingIdent(_, _, name) =>
1071-
memberName.isEmpty || name == memberName.toString
1071+
memberName.isEmpty || name == memberName
10721072
case _ => false
10731073
case _ => false
10741074

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ class Typer extends Namer
451451
// of a this(...) constructor call
452452
errorType(ex"$tree is not accessible from constructor arguments", tree.sourcePos)
453453
else
454-
errorType(new MissingIdent(tree, kind, name.show), tree.sourcePos)
454+
errorType(new MissingIdent(tree, kind, name), tree.sourcePos)
455455

456456
val tree1 = ownType match {
457457
case ownType: NamedType =>

0 commit comments

Comments
 (0)