Sdk: Linter crashes on the new `mixin` syntax

Created on 28 Sep 2018  路  25Comments  路  Source: dart-lang/sdk

Linter crashes on the new mixin syntax:

Flutter PR that triggers it: https://github.com/flutter/flutter/pull/22435
Logs pointing at the linter: https://cirrus-ci.com/task/6252230697025536

This is currently blocking my efforts to move Flutter to the new super-mixins.

@pq @JekCharlsonYu

analyzer-linter customer-flutter type-bug

All 25 comments

/cc @scheglov @bwilkerson

@yjbanov : what SDK are you trying to roll?

If I'm reading it correctly, Flutter is currently rolled up to 7f9a9feae181573cca609fd1b8760d7992176699

It seems that this is not fixed yet - there are many places where we cast MethodDeclaration.parent to ClassDeclaration.

The bug has been fixed in the linter package (https://github.com/dart-lang/linter/pull/1184). Needs to be published and pulled into the SDK. @pq

The fix has been pulled into the SDK.

Fixed in linter 0.1.65. Up on pub and in the SDK as of https://github.com/dart-lang/sdk/commit/8a919426f0e8665a0e6b01c2fcf3113587f8b040. 馃憤

Should I be worried about the failed documentation builds? https://pub.dartlang.org/packages/linter#-versions-tab-

When I attempt to upgrade to the latest linter using flutter upgrade-packages --force-upgrade it only gets me up to 0.1.61. Have version constraints changed?

I don't know. @pq

@yjbanov: it looks like we bumped the SDK constraint in 0.1.62:

environment:
  sdk: '>=2.1.0-dev.4.0 <3.0.0'

Should I be worried about the failed documentation builds?

Hmmmm, the above version constraint is breaking the docs as well:

STDERR:
ERR : The current Dart SDK version is 2.0.0.
    | 
    | Because linter requires SDK version >=2.1.0-dev.4.0 <3.0.0, version solving failed.

@jcollins-g: do you know why the toolEnv is behind the runtime Dart SDK in the dartdoc runs?

toolEnv Dart SDK: 2.0.0
runtime Dart SDK: 2.1.0-dev.2.0

Also, any idea why toolEnv is still on dev.2.0?

@bwilkerson @a14n : can you think of any downside to relaxing the SDK constraint?

... can you think of any downside to relaxing the SDK constraint?

I'm not aware of any API that linter is using that is only available in newer SDKs, but that doesn't mean there isn't any. I would want to look to see when the SDK constraint was bumped and why, then run the linter tests against an earlier build of the SDK to be doubly sure. That said, I don't think we should need to relax the constraints.

It seems to me that Flutter should reject any package that is not compatible with the version of the SDK that is being rolled in. Unless a package has been tested against the same version of the SDK that it will be run against, there is no guarantee that it isn't using an API that has been removed. (That should be less true after 2.1, but I think even 2.1 has a few breaking changes in it.)

cc @isoos, can you clarify why pub is still using 2.0.0 as @pq mentions in https://github.com/dart-lang/sdk/issues/34615#issuecomment-425647630 ?

@mit-mit @pq:

toolEnv Dart SDK: 2.0.0

This is the SDK version pub is using for analysis (pub upgrade, dartfmt, dartanalyzer). Since 2.0 got out, we don't track the latest dev SDKs with the analysis. Note: this is a manual process, if there is a new release, we will need to update it ourselves.

runtime Dart SDK: 2.1.0-dev.2.0

This is the runtime the pub site itself is using to run. We can use different versions in case it is needed.

The analysis of linter on pub fails, because newer versions have SDK contraints like linter requires SDK version >=2.1.0-dev.4.0 <3.0.0, (as stated on the analysis tab).

I attempted to force version 0.1.65 of linter. This is what I got back from the resolver:

pubspec.yaml generated by flutter update-packages --force-upgrade:

name: flutter_update_packages
dependencies:
  flutter_gallery_assets: 0.1.6
  linter: 0.1.65
  args: any
  file: any
  image: any
  meta: any
  path: any
  platform: any
  process: any
  stack_trace: any
  vm_service_client: any
  test: any
  vector_math: any
  xml: any
  archive: any
  http: any
  intl: any
  mockito: any
  path_provider: any
  collection: any
  assets_for_android_views:
    path: /home/yjbanov/code/flutter/flutter/bin/cache/pkg/goldens/dev/integration_tests/assets_for_android_views
  http_parser: any
  intl_translation: any
  isolate: any
  device_info: any
  connectivity: any
  string_scanner: any
  url_launcher: any
  cupertino_icons: any
  video_player: any
  json_rpc_2: any
  web_socket_channel: any
  quiver: any
  analyzer: any
  cli_util: any
  completion: any
  coverage: any
  crypto: any
  json_schema: any
  mustache: any
  package_config: any
  plugin: any
  stream_channel: any
  usage: any
  yaml: any
  file_testing: any
  typed_data: any
dependency_overrides:

Output:

Running "flutter packages upgrade" in flutter_update_packages.UXSLOK...      
The current Dart SDK version is 2.1.0-dev.6.0.flutter-2aac05fe10.

Because linter >=0.1.63 depends on analyzer ^0.33.0-alpha.0 and intl_translation >=0.17.0 depends on analyzer ^0.32.1, linter >=0.1.63 is incompatible with intl_translation >=0.17.0.
And because intl_translation <0.17.0 requires SDK version >=1.12.0 <2.0.0, linter >=0.1.63 is incompatible with intl_translation.
So, because flutter_update_packages depends on both intl_translation any and linter 0.1.65, version solving failed.

pub upgrade failed (1)

Note that we're also forcing a specific version of flutter_gallery_assets, but it's pubspec.yaml is not very restrictive.

assets_for_android_views is also pretty simple:

name: assets_for_android_views
description: Recorded touch event sequences
version : 0.1.0
author: Flutter Team <[email protected]>
homepage: http://flutter.io
environment:
  sdk: '>=1.19.0 <3.0.0'
  flutter: '>=0.1.0 <2.0.0'

flutter:
  assets:
    - assets/touchEvents

Thanks for all the follow-up. I'll widen constraints. It's not obvious that narrowed constraints are doing us any good. Ever. 馃槮

Because linter >=0.1.63 depends on analyzer ^0.33.0-alpha.0 and intl_translation >=0.17.0 depends on analyzer ^0.32.1, linter >=0.1.63 is incompatible with intl_translation >=0.17.0.

Widening the SDK constraints in linter might resolve some of the issues, but I don't believe that it will resolve this issue. It looks like intl_translation needs to be updated to accept analyzer ^0.33.0.

@alan-knight

Filed https://github.com/dart-lang/pub-dartlang-dart/issues/1665 for documentation build problem.

Linter 0.1.66 is published.

Roll into SDK DEPS is in the CQ.

Published intl_translation 0.17.2

Thanks!

I was able to pub upgrade to 0.1.66. Thank you! Will test and send a PR to bring Flutter to the latest and greatest package versions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jmesserly picture jmesserly  路  3Comments

DartBot picture DartBot  路  3Comments

55555Mohit55555 picture 55555Mohit55555  路  3Comments

gspencergoog picture gspencergoog  路  3Comments

sgrekhov picture sgrekhov  路  3Comments