Skip to content

The common front-end should give better error messages for the >>> operator. #35218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lrhn opened this issue Nov 20, 2018 · 0 comments
Open
Labels
improve-diagnostics Related to the quality of diagnostic messages legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@lrhn
Copy link
Member

lrhn commented Nov 20, 2018

The >>> operator was added back to the Dart language specification for Dart 2.0.
It should be implemented as a valid overridable operator (#30888).

The current implementation still doesn't do so, and gives very odd error messages.

Example:

class C {                                                                       
  operator>>>(o) => this;
}
main() {
  C() >>> 42;
}

gives the errors:

tsh2.dart:2:11: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
  operator>>>(o) => this;
          ^^
tsh2.dart:2:13: Error: Expected '{' before this.
  operator>>>(o) => this;
            ^
tsh2.dart:2:11: Error: Operator '>>' should have exactly one parameter.
  operator>>>(o) => this;
          ^^
tsh2.dart:2:13: Error: Operator declarations must be preceeded by the keyword 'operator'.
Try adding the keyword 'operator'.
  operator>>>(o) => this;
            ^
tsh2.dart:5:9: Error: Expected an identifier, but got '>'.
  C() >>> 42;
        ^
tsh2.dart:1: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
@lrhn lrhn added the legacy-area-front-end Legacy: Use area-dart-model instead. label Nov 20, 2018
@lrhn lrhn changed the title The common front-end should support the >>> operator. The common front-end should give better error messages for the >>> operator. Nov 20, 2018
@askeksa-google askeksa-google added the improve-diagnostics Related to the quality of diagnostic messages label Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improve-diagnostics Related to the quality of diagnostic messages legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

2 participants