Skip to content
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

Poor recovery with comma in extends clause #22313

Closed
bwilkerson opened this issue Feb 6, 2015 · 4 comments
Closed

Poor recovery with comma in extends clause #22313

bwilkerson opened this issue Feb 6, 2015 · 4 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-fasta-recovery P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@bwilkerson
Copy link
Member

Enter the following code in a Dart file:

class A { }
class B { }
class Foo extends A, B {
  Foo() { }
}

This results in many errors being produced, but only one is useful: the extends clause takes a single type, not a list of types. We should have a single error with a better error message.

@sethladd
Copy link
Contributor

sethladd commented Feb 6, 2015

Added Usability label.

@bwilkerson
Copy link
Member Author

Removed Type-Defect, Usability labels.
Added Type-Enhancement, Analyzer-UX labels.

@bwilkerson bwilkerson added Type-Enhancement area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-recovery analyzer-ux labels Feb 6, 2015
@bwilkerson bwilkerson self-assigned this Feb 6, 2015
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed triaged labels Mar 1, 2016
@bwilkerson bwilkerson removed their assignment Aug 15, 2016
@bwilkerson
Copy link
Member Author

Test for parser recovery added: https://dart-review.googlesource.com/c/sdk/+/37160

@srawlins
Copy link
Member

Currently, the example generates 4 errors:

$ dart 22313.dart 
22313.dart:3:19: Error: A class declaration must have a body, even if it is empty.
Try adding an empty body.
class Foo extends A, B {
                  ^
22313.dart:3:20: Error: Expected a declaration, but got ','.
class Foo extends A, B {
                   ^
22313.dart:3:22: Error: A function declaration needs an explicit list of parameters.
Try adding a parameter list to the function declaration.
class Foo extends A, B {
                     ^
22313.dart:3:22: Error: 'B' is already declared in this scope.
class Foo extends A, B {
                     ^
22313.dart:2:7: Context: Previous declaration of 'B'.
class B { }
      ^

@srawlins srawlins added area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-fasta-recovery and removed analyzer-recovery analyzer-ux area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-fasta-recovery P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants