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

Pub upgrade did not trigger analysis #17179

Closed
stevemessick opened this issue Feb 27, 2014 · 11 comments
Closed

Pub upgrade did not trigger analysis #17179

stevemessick opened this issue Feb 27, 2014 · 11 comments
Assignees
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.

Comments

@stevemessick
Copy link
Contributor

Username: kasperl

I just ran 'pub upgrade' on a project which updated one of my dependencies. Then I started the project in Dartium, but unfortunately a constructor had changed so Dartium stopped with a NSM error. However, I didn't get any static warning in the editor before I chose 'Reanalyze sources'.
////////////////////////////////////////////////////////////////////////////////////
Editor: 1.2.0.dev_05_15 (2014-02-24)
OS: Mac OS X - x86_64 (10.9.2)
JVM: 1.6.0_65

projects: 1

open dart files: 1

auto-run pub: true
localhost resolves to: 127.0.0.1
mem max/total/free: 1996 / 266 / 162 MB
thread count: 31
index: 235202 relationships in 50083 keys in 260 sources

SDK installed: true
Dartium installed: true

@keertip
Copy link
Contributor

keertip commented Apr 16, 2014

https://codereview.chromium.org/240003005/

r35132


Added Fixed label.

@scheglov
Copy link
Contributor

Rolled back as https://codereview.chromium.org/252703004/


Added Triaged label.

@keertip
Copy link
Contributor

keertip commented May 7, 2014

Set owner to @danrubel.
Removed this from the 1.4 milestone.
Added this to the 1.5 milestone.

@stereotype441
Copy link
Member

Another manifestation of this bug is that it causes confusing warnings of the form "Foo cannot be assigned to Foo". Here's a repro:

  • Create a new project. In its pubspec.yaml, add a dependency on package "analyzer" version 0.15.1 (any package will do--I'm just using this as an example).
  • Add a file file1.dart:

  import 'package:analyzer/analyzer.dart';
  import 'file2.dart';
  main() {
    AstNode node = null;
    foo(node);
  }

  • Add a file file2.dart:

  import 'package:analyzer/analyzer.dart';
  foo(AstNode node) {
  }

  • There should be no warnings.
  • Change pubspec.yaml to reference analyzer version 0.15.3 instead of version 0.15.1. Still no warnings.
  • Make a trivial edit to file1.dart (e.g. add a blank line). Suddenly a warning appears: "The argument type 'AstNode (.../.pub-cache/hosted/pub.dartlang.org/analyzer-0.15.3/lib/src/generated/ast.dart)' cannot be assigned to the parameter type 'AstNode (.../.pub-cache/hosted/pub.dartlang.org/analyzer-0.15.1/lib/src/generated/ast.dart)'".

A similar effect can happen even without changing the pubspec, if the version of analyzer is upgraded on the server and the user reruns "pub get".

The reason this happens is that after changing pubspec.yaml, the analyzer fails to notice that file1.dart and file2.dart are now referring to different versions of analyzer.dart than they were previously (and hence need to be reanalyzed). After file1.dart is trivially edited, the analyzer reanalyzes it and discovers that it is now referring to the AstNode from analyzer version 0.15.3. But it still (incorrectly) thinks file2.dart is still using the AstNode from analyzer version 0.15.1, so it reports the bogus warning.

@kasperl
Copy link

kasperl commented Jun 4, 2014

Removed this from the 1.5 milestone.
Added this to the 1.6 milestone.

@stereotype441
Copy link
Member

We decided this morning not to bother fixing this in the Java-based analyzer, since we are in the process of replacing that with he Dart-based analysis server.

I'm working on the fix for the Dart-based analysis server.


Set owner to @stereotype441.
Added Started label.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the 1.6 milestone.
Added Oldschool-Milestone-1.6 label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-1.6 label.

@sethladd
Copy link
Contributor

Removed Area-Editor label.
Added Area-Analyzer label.

@bwilkerson
Copy link
Member

Added Analyzer-Server label.

@stevemessick stevemessick added Type-Defect area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-server labels Aug 23, 2014
@bwilkerson
Copy link
Member

Cannot reproduce; assumed stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Projects
None yet
Development

No branches or pull requests

7 participants