Skip to content

Improvement of error message in case of ambiguous call #7523

@manuelmessner

Description

@manuelmessner

Condition:

type
  Foo = object
    bar: int

proc bar(cur: Foo, val: int) =
  discard cur.bar

proc does_fail(): Foo =
  result.bar(5)

can_fail()

This results in the following error message:

Error: in expression 'result.bar(5)': identifier expected, but found 'result.bar'

This error message needs some improvement, because it does not state, that the actual problem is, that there's an ambiguous call to bar.
The compiler cannot know whether the member bar of Foo is wanted, or whether the function bar should be called with result (of type Foo) as first argument.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions