Skip to content

Helpful error message when confusing a field with a method #2392

Closed
@catamorphism

Description

@catamorphism

I forget if there's already a bug on this, but it would be nice if, when you wrote A.B and A doesn't have a field named B, but does have a nullary method named B, the compiler gave a hint like "did you mean to write A.B()?" It could also do vice versa (if you write A.B()andAis a class with fieldB, it could ask "did you meanA.B```?)

I ran into this in trans, where I have frequently written bcx.ccx instead of bcx.ccx().

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-type-systemArea: Type systemE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.P-lowLow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions