This is the final CL in this set.
Disturbingly a couple of the bulk fix tests don't appear to have any
non-bulk test equivalents, just some assist tests. I'm assuming for the
time being that they're adequately tested by the assist tests.
Change-Id: I300558b3551061013e4cab8e97489597541d63bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205626
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
The purpose of this CL is to clean up test code that references `main`
in a way that will be invalid when the tests are converted to analyze
the test code under null safety by default. This is the first of three
such CLs.
In all three I only touched test files that contained an invalid use of
`main`, but in any file I touched I removed any use of `main` where the
name of the function/method was not critical to the test.
Change-Id: Ib753302a4c3ffc7eb5f248e9c6000e80dc77fca9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205062
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
We should rename ClassMemberLocation to reflect the wider usage, but I
thought it would be better to do that in a separate CL.
Closes: https://github.com/dart-lang/sdk/issues/38693
Change-Id: I657f7945022b09eb8deb89d8f2f5d43164fe53cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205061
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Sorry for the size of the CL. In reptrospect I should have changed the
defaults in any test class with failing tests and then converted them
one-by-one the way you did in analyzer. I'm happy to do anything I can
to make this easier to review.
Change-Id: I0a729d0d07cc3083a9892cfb1ddc75a06ad8f0dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204748
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
When a local variable doesn't have an initializer we now look for
assignments to find a reasonable type. This will not only allow this
lint to be fixed but will increase the number of places the assist is
offered.
Change-Id: Ib278477d277557aff7d2ddbcca3230f2a0a144b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204521
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Also suggest 'dynamic' after 'as' in a type cast.
Change-Id: I1e9f9f3a894e2c094aa4a6785fcdcfc60fb34260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203289
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This change makes sense to me for a couple of reasons. First, when
editing a correction producer the information about whether it can be
bulk applied will be easier to find. Second, the information doesn't
need to be duplicated when the producer can be applied to multiple
error codes. And third, because the information is in one place we can't
enable a producer in one place and miss enabling it in other places.
This does have the unfortunate consequence that an extra producer needs
to be created for bulk application in order to determine whether it
should be applied at all, and can't be re-used because producers
maintain state. We could consider storing a 'generator' object rather
than a generator function in the map and have the `newInstance` methods
produce those objects, but I'm not convinced that it's worthwhile given
how short lived the extra producer is.
There was also one subtle change that you probably won't see by looking
at the changes, which is that one of the producers was enabled for bulk
application for a lint but not enabled for several non-lint cases. It is
now enabled everywhere. I remember thinking at the time that it should
be fine, but I've forgotten which producer it was, so I can't easily
tell you. If you want to confirm that change I'll be happy to do the
work of figuring out which producer it is and which error codes were
impacted by the change.
Change-Id: I2010d777f727472c0d307a6948b84d37491e2b17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
We suggest user-defined identifier anywhere inside the first token, so I
think we should be consistent and suggest keywords there as well. As a
bonus, this will increase the accuracy of our completion metrics.
Change-Id: I88daf6b3b047ccfacd06cf25184d8bbbf42c682b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202064
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
I added one test for this case and several other tests for already
passing cases. I think that some of these cases were failing before the
switch away from using available suggestions for imported libraries and
was originally trying to write a test for a different reported problem,
but the test passed.
Change-Id: I989d8419506c59b883fe5b52168e15fd7d68787c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This is a re-do of https://dart-review.googlesource.com/c/sdk/+/197880
that removes the support for Cider. We might try using this for Cider at
some future date, but I didn't want that support to prevent us from
getting this to users sooner.
Change-Id: Ia5c06a8a3d7366770dedb4f51153c2f4004bb89e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201021
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This allows https://github.com/Dart-Code/Dart-Code/issues/3318 to be fixed by giving clients something they can use to reset coloring and preventing inheriting from other highlighting they may apply.
Change-Id: I3f1ba2c15d64634b203064d1451fb4fef040eb60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200863
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
If the `prefer_relative_imports` lint is enabled, then suggest relative
import URIs before absolute ones.
Also bring the relevant code in line with Effective Dart:
* DO capitalize acronyms and abbreviations longer than two letters like words. ("Uri" vs "URI")
* AVOID lines longer than 80 characters. (in doc comments)
* DO separate the first sentence of a doc comment into its own paragraph.
* PREFER starting function or method comments with third-person verbs.
Fixes https://github.com/dart-lang/sdk/issues/32916
Change-Id: I2e235cc84bd93e5593a96456eb9b0c615811e268
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200660
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
In a given library, every import directive has a set of "used
elements," the subset of elements provided by the import which are
used in the library. In a given library, an import directive is
"unnecessary" if there exists at least one other import directive
with the same prefix as the aforementioned import directive, and a
"used elements" set which is a proper superset of the
aforementioned import directive's "used elements" set.
https://github.com/dart-lang/sdk/issues/44569
Change-Id: I4da43be36837cdafb07a0ab67a94e644f351e593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177221
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This doesn't change the way any of the fixes can be applied, nor the set
of fixes associated with any code. It merely finishes a re-organization
task that was started earlier.
Change-Id: I911961fe5ec2aea211a6f0a51db24a4c4b32be26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200061
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Added user tags for profiling and started tracking the distribution of
completion times.
Change-Id: I57153aa550787535ee955359a810cabbdee1941b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198360
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Previously if no Bazel/Blaze symlinks were present, we defaulted to the
`bazel-*` ones and never checked if that assumption was accurate. This
change starts watching the symlinks and recreates the analysis contexts
if a symlink gets added. This way we'll run the `BazelWorkspace` code
again and use the correct paths.
This is quite important since `bazel/blaze clean` does remove the
symlinks so if the analysis server starts at such a point, we would
never find any generated files if the workspaced turned out to be a
Blaze one.
Bug: http://b/175087705
Change-Id: If7bb21c7d69a3092832c18004691d56949e5af54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197540
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Michal Terepeta <michalt@google.com>
Using ContextRoot.root locations directly leads to analyzing the whole
workspace for Bazel workspaces.
Change-Id: I44a31a5bc6043eaaea0e9c83f6261d54443ad7a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196494
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
These were found using the unnecessary-null-checks lint. It has a bug
that prevents us from enabling it at the moment, but we should consider
enabling it once the bug has been fixed.
Change-Id: Ice250b5a6a8723c5f08dec5b07ae738e17c842cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196550
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
As per our earlier conversation, I looked for places where a local
variable was introduced to overcome field promotion and has the same
name as the field. Where possible I made them final; where not possible
I changed the name.
Change-Id: Iad3d2139693ca66f1eb22a3926c3b84a4115f13d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196552
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This paves the way for allowing analyzer and analysis server clients
to format diagnostic message URLs in a special way (e.g. to make them
clickable).
Note that DiagnosticMessage is part of the public API of the analyzer,
so I've retained the old behavior in a deprecated fashion to avoid
breaking clients that don't yet handle diagnostic messages containing
URLs.
See
https://dart-review.googlesource.com/c/sdk/+/193749/comment/86d1ce4b_77a60b1e/
for additional discussion.
Change-Id: Iae9d43a2be7dbc67cb7cb82afe0a7824043d6113
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196101
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>