Skip to content

[ddc] Improve NSM error messages #52190

Open
@nshahan

Description

@nshahan

There are already custom error messages to help make the problem more clear for a lot of cases but overall the messages could be improved.

Example:

void gFn<T>() => print(T);

main() {
  dynamic d = gFn<int>;
  d<String>();
}

Error:

NoSuchMethodError: 'result'
Dynamic call with unexpected type arguments. Expected: 0 Actual: 1
Receiver: Instance of '() => void'
Arguments: []
 

One possibility would be to use a pattern more like the VM has now where it shows the attempted call with args and they type of the value being invoked. Some areas for improvement in the wording:

  • instance vs static class members
  • setters vs getters vs methods
  • tearoff closures vs null values vs methods
  • arguments passed vs expected
  • type arguments passed vs expected
  • correct names where applicable

Related: #49628

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-dev-compilerweb-triage-1priority assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions