File tree 3 files changed +20
-1
lines changed
compiler/src/dotty/tools/dotc/reporting
3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ object DidYouMean:
149
149
if d != 0 || b.sym.is(ModuleClass ) => // Avoid repeating the same name in "did you mean"
150
150
if qualifies(b) then
151
151
def hint (b : Binding ) = prefix ++ showName(b.name, b.sym)
152
- val alts = alternatives(d, rest).map(hint).take(3 )
152
+ val alts = alternatives(d, rest).filter(_.name != b.name). map(hint).take(3 ).distinct
153
153
val suffix = if alts.isEmpty then " " else alts.mkString(" or perhaps " , " or " , " ?" )
154
154
s " - did you mean ${hint(b)}? $suffix"
155
155
else
Original file line number Diff line number Diff line change
1
+ -- [E008] Not Found Error: tests/neg/i19958.scala:1:21 -----------------------------------------------------------------
2
+ 1 |val b = new Object().unit // error
3
+ | ^^^^^^^^^^^^^^^^^
4
+ | value unit is not a member of Object - did you mean Object.wait?
5
+ -- [E008] Not Found Error: tests/neg/i19958.scala:10:10 ----------------------------------------------------------------
6
+ 10 |val d = c.unit // error
7
+ | ^^^^^^
8
+ | value unit is not a member of C - did you mean c.blit? or perhaps c.wait?
Original file line number Diff line number Diff line change
1
+ val b = new Object ().unit // error
2
+
3
+ abstract class C :
4
+ def wait : Unit
5
+ def wait (x : Int ): Unit
6
+ def blit : Unit
7
+ def blit (x : Int ): Unit
8
+
9
+ val c : C = ???
10
+ val d = c.unit // error
11
+
You can’t perform that action at this time.
0 commit comments