8000 Improve message when using Dart 3.0 features w/o Dart 3.0 enabled · Issue #52324 · dart-lang/sdk · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve message when using Dart 3.0 features w/o Dart 3.0 enabled #52324

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
pq opened this issue May 9, 2023 · 1 comment
Open

Improve message when using Dart 3.0 features w/o Dart 3.0 enabled #52324

pq opened this issue May 9, 2023 · 1 comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. 8000 devexp-ux devexp-warning Issues with the analyzer's Warning codes model-error-recovery Error recovery in analyzer/CFE. 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

@pq
Copy link
Member
pq commented May 9, 2023

In a project with 2.19 as an SDK upper bound, code that tries to use Dart 3.0 features like this:

class C {
  bool isString(Object o) {
    return switch (o) {
      String() => true,
      _ => false,
    };
  }
}

Produces the following diagnostics:

error: Expected an identifier. (missing_identifier at [analyzer] lib/src/error/use_result_verifier.dart:250)
error: Expected to find ';'. (expected_token at [analyzer] lib/src/error/use_result_verifier.dart:250)
error: A value of type 'dynamic' can't be returned from the method 'isString' because it has a return type of 'bool'. (return_of_invalid_type at [analyzer] lib/src/error/use_result_verifier.dart:250)
error: Expected to find 'case'. (expected_token at [analyzer] lib/src/error/use_result_verifier.dart:251)

I expect what folks really want to see is one message like:

Oh hi, it looks like you're trying to use Dart 3.0 but don't have it enabled. Try bumping your SDK lower bound and you'll be good to go!

(Obviously it should be better but this is the idea.)

@pq pq added legacy-area-analyzer Use area-devexp instead. devexp-ux P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug dart-model-language-patterns Issues with analyzer's support for the patterns language feature devexp-warning Issues with the analyzer's Warning codes labels May 9, 2023
@bwilkerson bwilkerson added legacy-area-front-end Legacy: Use area-dart-model instead. front-end-fasta-recovery labels May 9, 2023
@stereotype441 stereotype441 added area-fe-analyzer-shared and removed legacy-area-analyzer Use area-devexp instead. legacy-area-front-end Legacy: Use area-dart-model instead. front-end-fasta-recovery labels May 9, 2023
@stereotype441
Copy link
Member

I'm planning on improving this in the Dart 3.1 timeframe.

7414
@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed area-fe-analyzer-shared labels Feb 27, 2025
@bwilkerson bwilkerson removed the dart-model-language-patterns Issues with analyzer's support for the patterns language feature label Mar 13, 2025
@johnniwinther johnniwinther added model-error-recovery Error recovery in analyzer/CFE. and removed fe-analyzer-shared-parser-recovery labels Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-ux devexp-warning Issues with the analyzer's Warning codes model-error-recovery Error recovery in analyzer/CFE. 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
0