8000 Analyzer recovery: unhelpful errors caused by extra < in type parameters · Issue #43141 · dart-lang/sdk · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ sdk Public

Analyzer recovery: unhelpful errors caused by extra < in type parameters #43141

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
whesse opened this issue Aug 21, 2020 · 0 comments
Open
Labels
analyzer-recovery legacy-area-front-end Legacy: Use area-dart-model instead. model-error-recovery Error recovery in analyzer/CFE. P3 A lower priority bug or feature request

Comments

@whesse
Copy link
Contributor
whesse commented Aug 21, 2020

The error messages generated by this code with an extra < are not very helpful, and appear on lines
much earlier than the error occurs at. The analyzer thinks a field called "Map" is being added to the class.
And the error messages for the error location don't indicate anything about type parameters or <.
Could recovery do a better job by not incorrectly adding this field?
These messages appear on Dart stable 2.9 and dev 2.10.0-45.0.dev

The code is:

class QueryResults extends ChangeNotifier {
  Filter filter;
  final foo = {1:2};
  Map<int, int> bar = {1:2};
  bool showAll = true;
  List<String> names = [];
  Map<String, <Map<String, int>>> counts = {};  // ERROR: extra < before Map.
  Map<String, Map<ChangeInResult, List<Result>>> grouped = {};
  bool partialResults = true;
}

The error messages are:

error: The instance member 'Map' can't be accessed in an initializer. (implicit_this_reference_in_initializer at [flutter_current_results_a] lib/query.dart:18)
error: Map isn't a type. (not_a_type at [flutter_current_results_a] lib/query.dart:18)
error: A function body must be provided. (missing_function_body at [flutter_current_results_a] lib/query.dart:21)
error: Expected an identifier. (missing_identifier at [flutter_current_results_a] lib/query.dart:21)
error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name. (missing_const_final_var_or_type at [flutter_current_results_a] lib/query.dart:21)
error: Methods must have an explicit list of parameters. (missing_method_parameters at [flutter_current_results_a] lib/query.dart:21)
error: The instance member 'Map' can't be accessed in an initializer. (implicit_this_reference_in_initializer at [flutter_current_results_a] lib/query.dart:22)
error: Map isn't a type. (not_a_type at [flutter_current_results_a] lib/query.dart:22)
@whesse whesse added P3 A lower priority bug or feature request analyzer-recovery labels Aug 21, 2020
@devoncarew devoncarew added legacy-area-front-end Legacy: Use area-dart-model instead. front-end-fasta-recovery labels Aug 24, 2020
@johnniwinther johnniwinther added model-error-recovery Error recovery in analyzer/CFE. and removed front-end-fasta-recovery labels Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-recovery legacy-area-front-end Legacy: Use area-dart-model instead. model-error-recovery Error recovery in analyzer/CFE. P3 A lower priority bug or feature request
Projects
None yet
Development

No branches or pull requests

3 participants
< 2A7E /div>
0