Skip to content

Use new NotAMember new error format in PostTyper #3420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/transform/PostTyper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import util.Positions._
import Decorators._
import config.Printers.typr
import Symbols._, TypeUtils._, SymUtils._
import reporting.diagnostic.messages.SuperCallsNotAllowedInline
import reporting.diagnostic.messages.{NotAMember, SuperCallsNotAllowedInline}

/** A macro transform that runs immediately after typer and that performs the following functions:
*
Expand Down Expand Up @@ -272,7 +272,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
def checkIdent(ident: untpd.Ident): Unit = {
val name = ident.name.asTermName
if (name != nme.WILDCARD && !exprTpe.member(name).exists && !exprTpe.member(name.toTypeName).exists)
ctx.error(s"${ident.name} is not a member of ${expr.show}", ident.pos)
ctx.error(NotAMember(exprTpe, name, "value"), ident.pos)
}
selectors.foreach {
case ident: untpd.Ident => checkIdent(ident)
Expand Down
2 changes: 1 addition & 1 deletion compiler/test-resources/repl/importFromObj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ val res0: scala.collection.mutable.ListBuffer[Int] = ListBuffer(1, 2, 3)
scala> import util.foo
1 | import util.foo
| ^^^
| foo is not a member of util
| value `foo` is not a member of util - did you mean `util.Left`?
scala> import util.foo.bar
1 | import util.foo.bar
| ^^^^^^^^
Expand Down