Skip to content

Poor suggested method reporting in the presence of overloads #19958

Closed
@lihaoyi

Description

@lihaoyi

Compiler version

3.4.0

Minimized example

val b = new Object().unit

Output Error/Warning message

[info] compiling 1 Scala source to /Users/lihaoyi/test/out/compile.dest/classes ...
[error] -- [E008] Not Found Error: /Users/lihaoyi/test/src/Main.scala:1:21 -------------
[error] 1 |val b = new Object().unit
[error]   |        ^^^^^^^^^^^^^^^^^
[error]   |value unit is not a member of Object - did you mean Object.wait? or perhaps Object.wait or Object.wait?

Why this Error/Warning was not helpful

The message was unhelpful because we repeat Object.wait three times, presumably because there are three overloaded methods wait that have similar names as .unit. This is useless, because those three overloads have the same name, and so displaying that name once is sufficient

Suggested improvement

It should just say

value unit is not a member of Object - did you mean Object.wait?

Metadata

Metadata

Assignees

Labels

area:reportingError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions