Skip to content

Commit a549dd1

Browse files
authored
Merge pull request #3420 from DSouzaM/not-a-member-err
Use new NotAMember new error format in PostTyper
2 parents dfe45fc + 5f2878b commit a549dd1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/transform/PostTyper.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import util.Positions._
1414
import Decorators._
1515
import config.Printers.typr
1616
import Symbols._, TypeUtils._, SymUtils._
17-
import reporting.diagnostic.messages.SuperCallsNotAllowedInline
17+
import reporting.diagnostic.messages.{NotAMember, SuperCallsNotAllowedInline}
1818

1919
/** A macro transform that runs immediately after typer and that performs the following functions:
2020
*
@@ -272,7 +272,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
272272
def checkIdent(ident: untpd.Ident): Unit = {
273273
val name = ident.name.asTermName
274274
if (name != nme.WILDCARD && !exprTpe.member(name).exists && !exprTpe.member(name.toTypeName).exists)
275-
ctx.error(s"${ident.name} is not a member of ${expr.show}", ident.pos)
275+
ctx.error(NotAMember(exprTpe, name, "value"), ident.pos)
276276
}
277277
selectors.foreach {
278278
case ident: untpd.Ident => checkIdent(ident)

compiler/test-resources/repl/importFromObj

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ val res0: scala.collection.mutable.ListBuffer[Int] = ListBuffer(1, 2, 3)
1515
scala> import util.foo
1616
1 | import util.foo
1717
| ^^^
18-
| foo is not a member of util
18+
| value `foo` is not a member of util - did you mean `util.Left`?
1919
scala> import util.foo.bar
2020
1 | import util.foo.bar
2121
| ^^^^^^^^

0 commit comments

Comments
 (0)