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

[meta] meta version 1.7.0 seems incompatible with analyzer 0.40.6 #46687

Closed
annagrin opened this issue Jul 21, 2021 · 26 comments
Closed

[meta] meta version 1.7.0 seems incompatible with analyzer 0.40.6 #46687

annagrin opened this issue Jul 21, 2021 · 26 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.

Comments

@annagrin
Copy link
Contributor

annagrin commented Jul 21, 2021

meta version 1.7.0 seems incompatible with analyzer 0.40.6 but does not have constraints preventing them from getting downloaded together by pub.

As a result, running pub upgrade with SDK 2.12.4 and using packages that depend on analyzer 0.40.6 (such as angular_test 3.0.0 and angular 6.0.1) causes build failures in user's code:

See: dart-lang/webdev#1363
Duplicate: #46686

@mit-mit
Copy link
Member

mit-mit commented Jul 22, 2021

cc @natebosch @jakemac53 @bwilkerson

@mit-mit mit-mit added the area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. label Jul 22, 2021
@jakemac53
Copy link
Contributor

jakemac53 commented Jul 22, 2021

This is a known issue, cc @scheglov.

If lots of people are running into this, then probably the easiest fix would be to release an analyzer 0.40.7 which does work with the latest meta.

@insinfo
Copy link

insinfo commented Jul 22, 2021

@jakemac53

easiest fix would be to release an analyzer 0.40.7

yes great idea, or maybe release an updated version of the "meta" 1.7.1 package that fixes it

@jakemac53
Copy link
Contributor

We can't fix it on the meta side - the issue is that it introduced a new top level symbol (or extension?) that collided with something in analyzer. Removing that now would be a breaking change, which wouldn't solve this problem (analyzer 0.40.6 wouldn't allow that version).

@scheglov
Copy link
Contributor

I could publish a modification of analyzer 0.40.6 as 0.40.7 and restrict to meta: '>=1.2.3 <1.4.0'.

@natebosch
Copy link
Member

I could publish a modification of analyzer 0.40.6 as 0.40.7 and restrict to meta: '>=1.2.3 <1.4.0'.

That might work in some cases, but I don't know how often pub will choose the working combination - if it chooses the latest meta then this constraint blocks them from getting the right analyzer, instead of the constraint blocking them from getting the wrong meta.

If we could make 0.40.7 compatible with that meta then pub is very likely to choose the working combination on an upgrade.

@scheglov
Copy link
Contributor

Thank you, @natebosch. Patching analyzer 0.40.6 to be compatible with newer meta sounds like a better idea.

@scheglov
Copy link
Contributor

I published analyzer 0.40.7, tested that it works with meta 1.2.3 and meta 1.7.0.

@insinfo
Copy link

insinfo commented Jul 22, 2021

I can confirm that it is working, with AngularDart 6.0.1 and dart 2.13

@SimonErich
Copy link

I am still getting the same error.
It seems I have analyzer 1.7.0.
Is there a fix for this version as well?

I cannot downgrade to 0.40.7, because otherwise I have a conflict with the crypto 2.0 package.

flutter pub run build_runner build
Failed to build build_runner:build_runner:
../../.pub-cache/hosted/pub.dartlang.org/analyzer-1.7.0/lib/src/error/best_practices_verifier.dart:266:50: Error: The property 'displayString' is defined in multiple extensions for 'TargetKind' and neither is more specific.
 - 'TargetKind' is from 'package:meta/meta_meta.dart' ('../../.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/meta_meta.dart').
Try using an explicit extension application of the wanted extension or hiding unwanted extensions from scope.
        var kindNames = kinds.map((kind) => kind.displayString).toList()
                                                 ^^^^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/analyzer-1.7.0/lib/src/error/best_practices_verifier.dart:2000:14: Context: This is one of the extension members.
  String get displayString {
             ^^^^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/meta_meta.dart:91:14: Context: This is one of the extension members.
  String get displayString {
             ^^^^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/analyzer-1.7.0/lib/src/error/best_practices_verifier.dart:268:36: Error: The getter 'commaSeparatedWithOr' isn't defined for the class 'List<dynamic>'.
 - 'List' is from 'dart:core'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'commaSeparatedWithOr'.
        var validKinds = kindNames.commaSeparatedWithOr;
                                   ^^^^^^^^^^^^^^^^^^^^
pub finished with exit code 1

@Fraa-124
Copy link

Same as previous comment
Because analyzer >=0.39.5 <0.41.2 depends on crypto ^2.0.0 and next depends on crypto ^3.0.1, analyzer >=0.39.5 <0.41.2 is forbidden. So, because next depends on analyzer 0.40.7, version solving failed

This starts to get frustrating: /

@insinfo
Copy link

insinfo commented Aug 1, 2021

@SimonErich @Fraa-124
for all those who are still experiencing this problem, just overwrite the "meta" dependency.

just add these lines to pubspec.yaml

dependency_overrides:
meta: 1.6.0

@scheglov
Copy link
Contributor

scheglov commented Aug 2, 2021

I think analyzer 1.7.2 was published as such compatible version.
https://pub.dev/packages/analyzer/versions/1.7.2/changelog

@renatoathaydes
Copy link

I am having this issue with the current latest versions of:

  • Dart (2.15.1)
  • analyzer-0.41.2
  • meta-1.7.0

My project has the following dependencies:

environment:
  sdk: '>=2.15.0 <3.0.0'

dependencies:

dev_dependencies:
  lints: ^1.0.1
  test: ^1.16.5

The problem started when I upgraded the Dart SDK version from sdk: '>=2.12.0 <3.0.0'.

If I add the line suggested by @insinfo to override the meta version, it works.

Alternatively, if I revert the update of the Dart SDK, it also seems to work.

Is the fix for this issue not released yet in the stable Dart SDK branch?

@renatoathaydes
Copy link

renatoathaydes commented Jan 6, 2022

Hm, something still doesn't work, actually.

Here's the error I was having initially:

▶ dart test
Building package executable... (1.1s)
Failed to build test:test:
../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:258:50: Error: The property 'displayString' is defined in multiple extensions for 'TargetKind' and neither is more specific.
 - 'TargetKind' is from 'package:meta/meta_meta.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/meta_meta.dart').
Try using an explicit extension application of the wanted extension or hiding unwanted extensions from scope.
        var kindNames = kinds.map((kind) => kind.displayString).toList()
                                                 ^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:1950:14: Context: This is one of the extension members.
  String get displayString {
             ^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/meta_meta.dart:91:14: Context: This is one of the extension members.
  String get displayString {
             ^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:260:36: Error: The getter 'commaSeparatedWithOr' isn't defined for the class 'List<dynamic>'.
 - 'List' is from 'dart:core'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'commaSeparatedWithOr'.
        var validKinds = kindNames.commaSeparatedWithOr;
                                   ^^^^^^^^^^^^^^^^^^^^
Failed to build test:test:
../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:258:50: Error: The property 'displayString' is defined in multiple extensions for 'TargetKind' and neither is more specific.
 - 'TargetKind' is from 'package:meta/meta_meta.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/meta_meta.dart').
Try using an explicit extension application of the wanted extension or hiding unwanted extensions from scope.
        var kindNames = kinds.map((kind) => kind.displayString).toList()
                                                 ^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:1950:14: Context: This is one of the extension members.
  String get displayString {
             ^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/meta_meta.dart:91:14: Context: This is one of the extension members.
  String get displayString {
             ^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:260:36: Error: The getter 'commaSeparatedWithOr' isn't defined for the class 'List<dynamic>'.
 - 'List' is from 'dart:core'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'commaSeparatedWithOr'.
        var validKinds = kindNames.commaSeparatedWithOr;
                                   ^^^^^^^^^^^^^^^^^^^^

As I mentioned before, I then tried going back to Dart 2.12, then using meta version 1.6.0 with the latest Dart SDK again... and it broke again:

▶ dart pub upgrade --major-versions
Resolving dependencies... (1.5s)
  _fe_analyzer_shared 32.0.0
  analyzer 3.0.0
  args 2.3.0
  async 2.8.2
  boolean_selector 2.1.0
  charcode 1.3.1
  cli_util 0.3.5
  collection 1.15.0
  convert 3.0.1
  coverage 1.0.4
  crypto 3.0.1
  file 6.1.2
  frontend_server_client 2.1.2
  glob 2.0.2
  http_multi_server 3.0.1
  http_parser 4.0.0
  io 1.0.3
  js 0.6.3 (0.6.4 available)
  lints 1.0.1
  logging 1.0.2
  matcher 0.12.11
! meta 1.6.0 (overridden) (1.7.0 available)
  mime 1.0.1
  node_preamble 2.0.1
  package_config 2.0.2
  path 1.8.1
  pool 1.5.0
  pub_semver 2.1.0
  shelf 1.2.0
  shelf_packages_handler 3.0.0
  shelf_static 1.1.0
  shelf_web_socket 1.0.1
  source_map_stack_trace 2.1.0
  source_maps 0.10.10
  source_span 1.8.1
  stack_trace 1.10.0
  stream_channel 2.1.0
  string_scanner 1.1.0
  term_glyph 1.2.0
  test 1.20.1
  test_api 0.4.9
  test_core 0.4.11
  typed_data 1.3.0
  vm_service 8.1.0
  watcher 1.0.1
  web_socket_channel 2.1.0
  webkit_inspection_protocol 1.0.0
  yaml 3.1.0
Warning: You are using these overridden dependencies:
! meta 1.6.0 (1.7.0 available)
No dependencies changed.
2 packages have newer versions incompatible with dependency constraints.
Try `dart pub outdated` for more information.

No changes to pubspec.yaml!

▶ dart test
Building package executable... (6.3s)
Failed to build test:test:
../../../.pub-cache/hosted/pub.dartlang.org/analyzer-3.0.0/lib/src/error/best_practices_verifier.dart:312:50: Error: The getter 'displayString' isn't defined for the class 'TargetKind'.
 - 'TargetKind' is from 'package:meta/meta_meta.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/meta-1.6.0/lib/meta_meta.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'displayString'.
        var kindNames = kinds.map((kind) => kind.displayString).toList()
                                                 ^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/analyzer-3.0.0/lib/src/error/best_practices_verifier.dart:314:36: Error: The getter 'commaSeparatedWithOr' isn't defined for the class 'List<dynamic>'.
 - 'List' is from 'dart:core'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'commaSeparatedWithOr'.
        var validKinds = kindNames.commaSeparatedWithOr;
                                   ^^^^^^^^^^^^^^^^^^^^
Failed to build test:test:
../../../.pub-cache/hosted/pub.dartlang.org/analyzer-3.0.0/lib/src/error/best_practices_verifier.dart:312:50: Error: The getter 'displayString' isn't defined for the class 'TargetKind'.
 - 'TargetKind' is from 'package:meta/meta_meta.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/meta-1.6.0/lib/meta_meta.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'displayString'.
        var kindNames = kinds.map((kind) => kind.displayString).toList()
                                                 ^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/analyzer-3.0.0/lib/src/error/best_practices_verifier.dart:314:36: Error: The getter 'commaSeparatedWithOr' isn't defined for the class 'List<dynamic>'.
 - 'List' is from 'dart:core'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'commaSeparatedWithOr'.
        var validKinds = kindNames.commaSeparatedWithOr;
                                   ^^^^^^^^^^^^^^^^^^^^

It now shows analyzer-3.0.0?!?

Finally, I had to remove the meta override to get it working again with Dart 2.15.1 :( . I think the problem is that the lock file must be deleted in order for the dependencies to get properly updated after this kind of change and I might have missed doing that?! Anyway, hope this helps others.

@toureholder
Copy link

toureholder commented Feb 3, 2022

Finally, I had to remove the meta override to get it working again with Dart 2.15.1 :( . I think the problem is that the lock file must be deleted in order for the dependencies to get properly updated after this kind of change and I might have missed doing that?! Anyway, hope this helps others.

Deleting the lock file then flutter pub get solved it for me as well.

@jakemac53
Copy link
Contributor

Deleting the lock file then flutter pub get solved it for me as well.

Fwiw this is functionally equivalent to running flutter pub upgrade. The get command never updates dependencies if there is a pubspec.lock, it just fetches those versions.

rundong08 added a commit to google/taqo-paco that referenced this issue Apr 19, 2022
The following issues are fixed
1. The implementation of a function in local_database_builder.dart did
   not match the expected result in the unit test
2. The dart packages meta 1.7.0 and analyzer 0.41.2 has a conflict that
   prevents the tests under taqo_common to run. See
   dart-lang/sdk#46687
@RomanSoviak
Copy link

RomanSoviak commented May 6, 2022

Issue still exists
Failed to build build_runner:build_runner: ../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-2.0.4/lib/src/resolver.dart:288:35: Error: The argument type 'Uri' can't be assigned to the parameter type 'String'.- 'Uri' is from 'dart:core'. return AssetId.resolve(source.uri);`

../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-2.0.4/lib/src/build_asset_uri_resolver.dart:147:30: Error: The argument type 'Uri' can't be assigned to the parameter type 'String'. - 'Uri' is from 'dart:core'. return AssetId.resolve(uri);

../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-2.0.4/lib/src/build_asset_uri_resolver.dart:214:49: Error: The argument type 'Uri' can't be assigned to the parameter type 'String'.- 'Uri' is from 'dart:core'. .map((content) => AssetId.resolve(Uri.parse(content), from: from)),

@mit-mit
Copy link
Member

mit-mit commented May 6, 2022

@RomanSoviak we need more information to understand that issue, and the current issue is already closed. Can you kindly file a new issue, and include your pubspec.yaml?

@RomanSoviak
Copy link

name: test
description: test_description

publish_to: none
version: 1.2.5+248

environment:
  sdk: ">=2.6.0 <3.0.0"

dependencies:
  after_layout: 1.0.7+2
  auto_size_text: 2.1.0
  avatar_glow: ^1.1.0
  back_button_interceptor: ^4.4.0
  cached_network_image: ^2.3.1
  cloud_firestore: ^2.5.4
  confetti: ^0.5.4+1
  connectivity: ^0.4.6+2
  cupertino_icons: ^0.1.2
  dartx: 0.7.1
  date_format: 1.0.8
  dio: ^4.0.0
  dotted_border: ^1.0.7
  drop_cap_text: ^1.1.3
  equatable: 1.2.5
  expandable: ^4.1.2
  faker: 1.2.1
  firebase_analytics: ^8.3.4
  firebase_auth: ^3.1.4
  firebase_core: ^1.8.0
  firebase_crashlytics: ^2.2.4
  firebase_messaging: ^11.2.6
  firebase_storage: ^10.0.6
  flutter:
    sdk: flutter
  flutter_bloc: 7.0.0-dev.1
  flutter_branch_sdk: ^1.1.0
  flutter_brand_icons: ^1.1.0
  flutter_cache_manager: ^2.1.2
  flutter_circular_chart_two: ^0.1.2
  flutter_custom_clippers: 1.0.4
  flutter_inapp_purchase: 5.0.0
  flutter_line_sdk: ^2.0.0
  flutter_local_notifications: ^7.0.0
  flutter_localizations:
    sdk: flutter
  flutter_screenutil: 2.1.0
  flutter_share: ^1.0.2+1
  flutter_sidekick:
    git:
     url: https://github.com/Jayshanx/flutter_sidekick
  flutter_staggered_grid_view: ^0.3.0
  flutter_tindercard: ^0.2.0
  flutter_widget_from_html_core: ^0.3.2+2
  fluttertoast: ^8.0.4
  freezed: ^0.14.0
  get_it: 7.0.0
  grouped_buttons:
    git:
     url: https://github.com/yura2000/grouped_buttons.git
  injectable: ^1.4.0
  injector: 1.0.8
  intl: 0.17.0
  jiffy: null
  json_annotation: 4.0.0
  just_the_tooltip: ^0.0.11+2
  keyboard_visibility: ^0.5.6
  liquid_progress_indicator: ^0.3.2
  loading_animations: 2.1.0
  modal_bottom_sheet: ^1.0.0+1
  ntp: ^1.0.5
  package_info: ^2.0.0
  page_indicator: 0.3.0
  page_transition: 1.1.5
  percent_indicator: 2.1.5
  permission_handler:
    git:
     url: https://github.com/yura2000/flutter-permission-handler.git
  qr_code_scanner: 0.5.1
  qr_flutter: ^3.2.0
  reorderables: 0.3.2
  rxdart: 0.24.1
  share: 0.6.3+5
  shared_preferences: 2.0.7
  shimmer: ^1.1.1
  sign_in_with_apple: ^3.2.0
  sliding_sheet: ^0.5.0
  sprintf: 4.0.2
  streaming_shared_preferences: ^2.0.0
  table_calendar: ^3.0.0
  timeago: ^2.0.27
  tuple: ^1.0.3
  url_launcher: 6.0.10
  visibility_detector: ^0.2.2
  flutter_animated_button: ^2.0.0
  smooth_page_indicator: ^1.0.0+2
dependency_overrides:
  build: 1.6.3

dev_dependencies:
  analyzer: 1.6.0
  build_runner: null
  flutter_test:
    sdk: flutter
  injectable_generator: 1.2.0
  json_serializable: 4.0.3
  lint: ^1.3.0

flutter:
  uses-material-design: true

flutter_intl:
  enabled: true

@mit-mit
here my pubsec.yaml,
and pubsec.lock:

...
sdks:
  dart: ">=2.16.0 <3.0.0"
  flutter: ">=2.10.0"

I tried different versions, but had no success

@mit-mit
Copy link
Member

mit-mit commented May 9, 2022

@RomanSoviak you've pinned build to a very old version (dependency_overrides: build: 1.6.3), which is holding back any dependency that also depends on build. Try running dart pub upgrade --major-versions to see what the stale deps are.

@RomanSoviak
Copy link

RomanSoviak commented May 10, 2022

@mit-mit
I updated to upper versions, run pub cache repair, clean caches, but no success
Dependencies updated to

...
  get_it: ^7.2.0
  grouped_buttons:
    git:
     url: https://github.com/yura2000/grouped_buttons.git
  injectable: ^1.4.0
  injector: ^2.0.0
  intl: 0.17.0
  jiffy: null
  json_annotation: ^4.1.0
  ...
  
  
dev_dependencies:
  analyzer: ^1.7.2
  build_runner: 2.1.10
  flutter_test:
    sdk: flutter
  injectable_generator: ^1.4.1
  json_serializable: ^4.1.4
  lint: ^1.3.0
  ...

Screenshot 2022-05-10 at 10 21 23

No success

@annagrin
Copy link
Contributor Author

@RomanSoviak Looks like you are still using the old build package - build-1.6.3. Have you tried removing the dependency override and running flutter pub upgrade?

@jakemac53
Copy link
Contributor

Right, build_runner version 2.1.10 requires at least package:build version 2.1.0.

@RomanSoviak
Copy link

Thanks for helping!

...
 build: 2.1.0

dev_dependencies:
  analyzer: ^2.8.0
  build_runner: 2.1.10
  ...

does the work

@annagrin
Copy link
Contributor Author

Awesome, you are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
Projects
None yet
Development

No branches or pull requests