-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Analyzer 1.6.0 on Dart 2.13.0 fail to precompile: Getter not found: 'topLevelVariable'. Type 'dynamic' of the case expression is not a subtype of type 'TargetKind' of this switch expression. #46142
Comments
Same, started happening after upgrading to build_runner 2.0.4 and analyzer 1.6.0 Forcing to use analyzer 1.5.0 seems to work. |
*for forced use of a specific version of the analyzer, you can add this block to pubspec.yaml
|
@pq - perhaps a versioning issue with your recent change - https://dart-review.googlesource.com/c/sdk/+/200900 ? |
@vsmenon: quite right. /fyi @devoncarew Sorry for the inconvenience @artnavsegda ! |
Just FYI, this breaks usage of In my case, I'm using Flutter 2.2, on the "stable" branch. Clearly when my install can be nerfed by a very distant change in the EDIT: Should this not be higher priority? It's causing |
@flutterfromscratch Eeeep. pubspec.yaml in Flutter pins meta to a specific version (1.3.0), forcing any package that uses Flutter and analyzer (even indirectly, e.g. through package test or build_runner) to prefer analyzer 1.6.0. Reopened #46136 and closing this as duplicate. |
cc @jakemac53 as I know he's thought about flutter package pinning and the implications. I hadn't realized that it means that a flutter stable release (pinning meta) will effectively also pin the analyzer version, and transitively all build related packages. |
Oh right 🤕 ... ya this is very problematic for this case in particular. Flutter users can override |
…e of the latest analyzer version: dart-lang/sdk#46142
Dart SDK version: 2.13.0 (stable) (Wed May 12 12:45:49 2021 +0200) on "macos_x64"
Failed to precompile build_runner:build_runner:
/opt/homebrew/Caskroom/flutter/2.2.0/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:1600:40: Error: Getter not found: 'topLevelVariable'.
return kinds.contains(TargetKind.topLevelVariable);
^^^^^^^^^^^^^^^^
/opt/homebrew/Caskroom/flutter/2.2.0/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:2024:23: Error: Getter not found: 'topLevelVariable'.
case TargetKind.topLevelVariable:
^^^^^^^^^^^^^^^^
/opt/homebrew/Caskroom/flutter/2.2.0/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:2024:23: Error: Type 'dynamic' of the case expression is not a subtype of type 'TargetKind' of this switch expression.
case TargetKind.topLevelVariable:
^
/opt/homebrew/Caskroom/flutter/2.2.0/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:2001:13: Context: The switch expression is here.
switch (this) {
^
pub finished with exit code 1
The text was updated successfully, but these errors were encountered: