Skip to content

Commit bf975e0

Browse files
committed
Fix accesibility error message for overloaded references
1 parent 48e939d commit bf975e0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,19 +213,19 @@ trait TypeAssigner {
213213
else {
214214
val alts = tpe.denot.alternatives.map(_.symbol).filter(_.exists)
215215
var packageAccess = false
216-
val what = alts match {
216+
val whatCanNot = alts match {
217217
case Nil =>
218-
name.toString
218+
em"$name cannot"
219219
case sym :: Nil =>
220-
if (sym.owner == pre.typeSymbol) sym.show else sym.showLocated
220+
em"${if (sym.owner == pre.typeSymbol) sym.show else sym.showLocated} cannot"
221221
case _ =>
222-
em"none of the overloaded alternatives named $name"
222+
em"none of the overloaded alternatives named $name can"
223223
}
224224
val where = if (ctx.owner.exists) s" from ${ctx.owner.enclosingClass}" else ""
225225
val whyNot = new StringBuffer
226226
alts foreach (_.isAccessibleFrom(pre, superAccess, whyNot))
227227
if (tpe.isError) tpe
228-
else errorType(ex"$what cannot be accessed as a member of $pre$where.$whyNot", pos)
228+
else errorType(ex"$whatCanNot be accessed as a member of $pre$where.$whyNot", pos)
229229
}
230230
}
231231
else ctx.makePackageObjPrefixExplicit(tpe withDenot d)

0 commit comments

Comments
 (0)