diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index 7fbfef5c75f1..90a85ec95a61 100644 --- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -293,7 +293,12 @@ object messages { ) } - ex"$selected `$name` is not a member of $site$closeMember" + val siteType = site match { + case tp: NamedType => tp.info + case tp => tp + } + + ex"$selected `$name` is not a member of $siteType$closeMember" } val explanation = "" diff --git a/tests/repl/errmsgs.check b/tests/repl/errmsgs.check index a1b3bd6ae415..bd47eb3e1c49 100644 --- a/tests/repl/errmsgs.check +++ b/tests/repl/errmsgs.check @@ -77,7 +77,7 @@ scala> class Foo() { def bar: Int = 1 }; val foo = new Foo(); foo.barr -- [E008] Member Not Found Error: :4:59 ------------------------------- 4 |class Foo() { def bar: Int = 1 }; val foo = new Foo(); foo.barr | ^^^^^^^^ - | value `barr` is not a member of Foo(foo) - did you mean `foo.bar`? + | value `barr` is not a member of Foo - did you mean `foo.bar`? scala> val x: List[Int] = "foo" :: List(1) -- [E007] Type Mismatch Error: :4:19 ---------------------------------- 4 |val x: List[Int] = "foo" :: List(1) diff --git a/tests/repl/imports.check b/tests/repl/imports.check index 12056280f021..45407099799f 100644 --- a/tests/repl/imports.check +++ b/tests/repl/imports.check @@ -24,5 +24,5 @@ scala> import util.foo.bar -- [E008] Member Not Found Error: :8:12 ------------------------------- 8 |import util.foo.bar | ^^^^^^^^ - | value `foo` is not a member of util.type - did you mean `util.Left`? + | value `foo` is not a member of util - did you mean `util.Left`? scala> :quit