Commit Graph

10502 Commits

Author SHA1 Message Date
Brian Wilkerson 2ab3ebad9d Remove a duplicated error code
The parser produces this diagnostic, so analyzer doesn't need to.

Change-Id: I39e2ade681e5580b6ca5493a334d87d66f51e1ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170041
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-11-02 05:06:02 +00:00
Brian Wilkerson 98ba51c48e Improve the highlight range for ambiguous_export
Change-Id: I0c4f887ad467fa5e186ad34650816f15956f623f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170021
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-11-01 15:25:11 +00:00
Brian Wilkerson 3fe3a0384f Improve the highlight range for invalid_super_invocation
Change-Id: I8be664802f04def78304b7cc0e8481d734d295e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170040
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-11-01 15:24:51 +00:00
Konstantin Shcheglov 77f2019f00 Use the current SDK language version by default.
Change-Id: I317ad3858b0f023cdf2fd02a1a28a9c22742b74c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169960
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-10-31 00:20:22 +00:00
Konstantin Shcheglov 7dcb9bba3e Use the releaseVersion in errors for ExperimentalFeatures.non_nullable
Change-Id: I46a623601aee90f19ce1770cda3c8125ec2ef941
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169943
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-30 23:39:12 +00:00
Brian Wilkerson 195820ec10 Update the message for sdk_version_never and comment in previously reviewed docs
Change-Id: I505e4a577feecbb4deb25eaaeb863a80c7e71602
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170000
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-10-30 23:17:12 +00:00
Brian Wilkerson 740857152a Fix the wording of a warning
Because this is only a warning the user can ignore it and the code will
compile and run without problem. Hence, the previous wording was a bit
strong.

Bug: https://github.com/dart-lang/sdk/issues/43189
Change-Id: Ibe4f048191b28230fede8e7e5d76943c5b56f31b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169962
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-10-30 22:57:32 +00:00
Konstantin Shcheglov 77a5f85dbf Simplify check for parameters DeprecatedMemberUseVerifier.
Follow up for https://dart-review.googlesource.com/c/sdk/+/169903

I believe inDeclarationContext() is unrelated and not necessary.

Using thisOrAncestorOfType() is cumbersome here, so I changed it
to iterating directily over parents.

Bug: https://github.com/dart-lang/sdk/issues/44004
Change-Id: I2ecd1d5833b4deaac8afcc8ac9a6a53c3eeb6f4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169921
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-30 20:32:32 +00:00
Sam Rawlins d0db3b1d23 Do not report @deprecated field formal parameters at their declaration.
Fixes https://github.com/dart-lang/sdk/issues/44004

Additionally, fix @deprecated parameters referenced in initializers.

Change-Id: Ibad9c3acaf3991c722bee95ecd58d3e3a04bb4cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169903
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-30 19:10:03 +00:00
Konstantin Shcheglov 5d383959ce Fix crash when integerDivide and the result is not finite.
There are crashes logged internally.

Change-Id: I8e5705017f976891981389135b4713a13f824f46
Bug: https://github.com/dart-lang/sdk/issues/43997
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169861
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-30 16:08:40 +00:00
Konstantin Shcheglov 2d4a3bd913 Fix UNUSED_ELEMENT for top-level getter/setter.
Change-Id: I4bba8f0d64176e8b96ce273a6679274665b901e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169789
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-30 06:27:50 +00:00
Leaf Petersen a6faf8f2f9 [Language] Enable null safety in Dart 2.12.
Closes https://github.com/dart-lang/sdk/issues/22

Change-Id: I662dd17fda0ff62a871314896fbf1dbe220f41de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166790
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2020-10-29 18:25:56 +00:00
Konstantin Shcheglov 619e388a1d Breaking changes for analyzer version 0.41.
Change-Id: Ib16351e05b498fa9879e6bb4c117638cde276bfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-29 17:08:16 +00:00
Erik Ernst f506071e34 Add DartType.alias{Element,Arguments} and class TypeAliasElement
First step in implementing non-function type aliases in the analyzer:
Just add the new back-references in types, such that they can refer to
a type alias which was used to obtain the type, if any.

Next step: Preserve the aliasElement and aliasArguments in summaries,
next again: Create `TypeAliasElementImpl` and ensure that the parser
can create them.

Change-Id: I1bfbc2c3893e32c5b1826552361a0238aa2b4058
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-10-29 14:39:33 +00:00
pq 3c5d1d2575 fix nodes for path error reporting
Change-Id: I515bda93559332d5f2177e6f3167c688c1c85ac8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-10-28 22:54:23 +00:00
Konstantin Shcheglov 774e18d14a Issue 43925. Set the enclosing class for completion.
Bug: https://github.com/dart-lang/sdk/issues/43925
Change-Id: Ide3c8ec104fb9eb92b4d15a14c352e8c7abcb82d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169480
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2020-10-28 21:56:40 +00:00
Konstantin Shcheglov 2fafb4061f Remove LibrariesLog, we don't use it anymore.
Change-Id: I6e72822b973af383726e53ad7ea11c6ebfc10afc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169522
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-28 21:25:30 +00:00
pq e5dfd38404 check for invalid git and path deps in publishable packages
Fixes: https://github.com/dart-lang/sdk/issues/43930

Change-Id: Ia1e7899cf04644387f2686e997e338baa197dac3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169246
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-10-28 20:32:50 +00:00
Konstantin Shcheglov 1958d61b02 Issue 43929. Report HintCode.DEPRECATED_MEMBER_USE for Null Safe from Legacy, refactoring.
Bug: https://github.com/dart-lang/sdk/issues/43929
Change-Id: Ib05f2e44f6cac2acfcb8b3708bd88e38df70d6c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169256
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-28 16:41:20 +00:00
Konstantin Shcheglov 2e99e59369 Fix integration tests for analyzer/ and analysis_server/ in preparation for Null Safety turned on.
Bug: https://github.com/dart-lang/sdk/issues/43777
Change-Id: Ibc5426dd3035c54306bed6e0dec8a6b379163057
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169286
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-28 15:42:55 +00:00
Konstantin Shcheglov 7a60fd3fd2 Fix Glob creation, PubspecValidator dependencyPath.
Change-Id: I898635487e8c51ec732deb64aef81dc68cc82a8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169254
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-28 00:57:53 +00:00
Konstantin Shcheglov 47a2ab2866 Prepare to publish analyzer 0.40.5 and _fe_analyzer_shared 12.0.0.
Change-Id: I58b8b62dd33343896900d398d8066777bb12e768
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-27 19:12:27 +00:00
Konstantin Shcheglov d9d7324b27 Issue 43777. Update analysis_server/ tests to run when Null Safety is enabled by default in 2.12
Bug: https://github.com/dart-lang/sdk/issues/43777
Change-Id: Ibd1da16b58b8304d6f1d4260615c7049fc5ffe59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169141
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-10-27 18:19:33 +00:00
pq 3b58a4adcd validate that pub dependencies have pubspecs
See: https://github.com/dart-lang/sdk/issues/43897

Change-Id: I6f22a045c537c3feb3d8f55b16d935ea9f858171
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169042
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-10-26 19:03:16 +00:00
Brian Wilkerson 6b3f3403ec Unify three diagnostic codes for documentation purposes
Change-Id: I46326160fedb26c92843698dd6513b9fe87e32dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169041
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-10-26 04:24:55 +00:00
Paul Berry 92c07fa8d2 Rename test files to end in _test.dart
The test runner that runs on the trybots only runs tests that end in
`_test.dart`, so it was failing to run these tests.

Change-Id: I77e92bafd4c907d15a7d511406ca81360aea382e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168995
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-25 19:37:05 +00:00
Konstantin Shcheglov 48f3b781ce Extract PackageConfigFileBuilder into lib/src/test_utilities
Change-Id: Iba06c81a709e9c2e37e60f71d087b4dbf0c3e6f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-24 18:35:23 +00:00
pq 1ea407ee6c validate path dependencies
Fixes: https://github.com/dart-lang/sdk/issues/43897

Change-Id: I83cf10ddbb6902db329d58f376f36b7005872a65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168882
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-10-24 02:39:53 +00:00
pq b16d6bba7f report @doNotStore assignment to top-level vars
Fixes: https://github.com/dart-lang/sdk/issues/43905

Change-Id: I730795543b2f302f9b7eb494791618a4837befe5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168989
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-10-24 02:34:43 +00:00
Jens Johansen 5a6129406f [parser] Consistently disallow 'late' without 'var', 'final' or type
Fixes https://github.com/dart-lang/sdk/issues/43811
Fixes https://github.com/dart-lang/sdk/issues/43812
Fixes https://github.com/dart-lang/sdk/issues/43813

Change-Id: I39de527883d33459694ec0f91b769676eb52d54b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168641
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-23 06:28:51 +00:00
Konstantin Shcheglov a669f440a6 Revert applying resolution after loading AST for summaries.
Reason: causes Flutter analysis performance regression.
https://github.com/flutter/flutter/issues/68716

We will get back to applying resolution after loading AST when
we switch to the binary format, and so recover enough performance.

WIP for it: https://dart-review.googlesource.com/c/sdk/+/168260
Unfortunately this means that it will get even bigger.


Revert "Separate AST from resolution (per declaration)."

This reverts commit 4d6fba37de.


Revert "Remove commented out code from LinkedUnitContext."

This reverts commit c4f2c8ec3e.


Revert "Issue 43890. Implement applying resolution to IndexExpression."

This reverts commit 088524efa6.


Revert "Issue 43888. Fix for applying resolution to PropertyAccess in cascade."

This reverts commit 1f660a7acf.

Change-Id: I808c1fc62161458d7544d7741e4b358c99b0b55f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-22 22:40:40 +00:00
Konstantin Shcheglov 1f660a7acf Issue 43888. Fix for applying resolution to PropertyAccess in cascade.
Bug: https://github.com/dart-lang/sdk/issues/43888
Change-Id: I3add81b30a3202964445a036f8944d7476b6fc91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168776
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-10-22 20:38:40 +00:00
Brian Wilkerson 52e968cdef Stop reporting invalid_modifier_on_setter twice
This was being reported by both the error reporter and the parser. This
removes the reporting in the error reporter.

Change-Id: I9934d8a07b530daaeed1ac9edb317c72b7a3655c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168764
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-10-22 20:27:50 +00:00
Konstantin Shcheglov 088524efa6 Issue 43890. Implement applying resolution to IndexExpression.
Bug: https://github.com/dart-lang/sdk/issues/43890
Change-Id: I537d157ca9ff583b09e7c09ff580202b9dc4ced3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168778
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-22 19:27:10 +00:00
Konstantin Shcheglov 934142766a Remove discarding libraries context on timeout.
Use `linkLibraries` before analysis (after save) instead.

Change-Id: I0b13888398b32cefb6815717c3b0f525492abac0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168767
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-22 16:43:00 +00:00
Brian Wilkerson fd44a07616 Fix handling of excludes from analysis options file in AnalysisContextCollection
Bug: https://github.com/dart-lang/sdk/issues/35519
Change-Id: I76856c0418336ab62ac153f03a6a017088a65847
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168762
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2020-10-21 21:17:04 +00:00
Paul Berry f1843b0abe Add special case migration logic for iterator methods.
This logic allows us to migrate code like this:

    int firstEven(Iterable<int> values)
        => values.firstWhere((i) => i.isEven, orElse: () => null);

Into:

    import 'package:collection/collection.dart' show IterableExtension;

    int? firstEven(Iterable<int> values)
        => values.firstWhereOrNull((i) => i.isEven);

Rather than the default behavior, which would migrate it to:

    int? firsteven(Iterable<int?> values)
        => values.firstWhere((i) => i!.isEven, orElse: () => null);

(The new migration is far superior because it doesn't require the
input iterable to accept null).

This functionality is disabled at the moment, because:
- The changes it makes don't show up properly in the web preview.
- The pubspec is not yet properly updated.

I will address these issues in follow-up CLs and then enable the
feature.

Change-Id: I96f3b12d682c586631920b38406bad6aa3f4789e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168500
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-20 17:45:04 +00:00
Lasse Reichstein Holst Nielsen 92e52a1874 Remove direct dependencies on package:charcode from SDK.
Change-Id: I9ef36e8a6890a70baac6c18f0be2252dcf5453df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163941
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-10-20 13:07:53 +00:00
Konstantin Shcheglov 92704cf8e4 Don't set types for class/constructor/getter identifiers of annotations.
They are not expressions, and so don't have types.

Actually setting a type for a constructor of a generic class breaks
summary serialization because `T Function()` type of the constructor
`class A<T> { const A.named()l }` is not valid - `T` is not in scope.
So, this crashed the linker.

Change-Id: I25a6e5eb6902faa479e4dcb683ef3936af07b5b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168420
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-19 23:25:48 +00:00
Konstantin Shcheglov c003c1a64d Don't read referenced files in AnalysisDriver until necessary.
Bug: https://github.com/dart-lang/sdk/issues/43744
Change-Id: I06d58b2a11fdf2db9bd6800f350ac25b8aab3fb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-19 19:00:07 +00:00
Konstantin Shcheglov 23b9cce2a1 Issue 43777. Update analyzer/ tests to run when Null Safety is enabled by default in 2.12
Bug: https://github.com/dart-lang/sdk/issues/43777
Change-Id: If7e5f71fe1d8277898a02745f96f1c8003cc8069
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168240
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-19 16:40:17 +00:00
Sam Rawlins ccba500cda Analyzer: Support visibleForTesting/Template on top-level variables
Fixes https://github.com/dart-lang/sdk/issues/43508

Change-Id: I5a0792c48c284ceedfc6edea70a5979647b6e39e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168162
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-19 15:36:57 +00:00
Paul Berry 0ad6807c62 Fix BazelWorkspace.findPackageFor's handling of binPaths.
Previously, we were assuming that each path in `binPaths` was just one
level deeper than the corresponding source code path, and therefore we
could map a path in `binPaths` to the corresponding source code path
by just removing the first directory (e.g. map `bazel-out/foo/bar` to
`foo/bar`).  But this isn't correct: the paths in `binPaths` are more
deeply nested, e.g. `bazel-out/k8-fastbuild/bin`.  This CL changes the
algorithm to use `context.relative`, so that we get the correct path
mapping regardless of the nesting depth.

Change-Id: I870a7fca18e689691efcc32da527135643255eca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168127
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-18 23:35:16 +00:00
Brian Wilkerson 35ce26e0db Validate ignore comments
This adds checks for three cases:
- error codes for diagnostics that are not being produced,
- error codes that can't be ignored (with a severity of error), and
- error codes that are already being ignored.

I originally also checked for names that are not defined as error codes
(which turned up at least one valid issue in the Flutter repo), but we
don't have a list of all valid names against which to compare because
plugins can add new diagnostics.

It should be noted that, as written, these diagnostics can't be ignored,
despite being hints. The reason is as follows: in order to detect
diagnostics that are not being produced, these checks need to have a
list of the diagnostics that _are_ produced. If an ignore comment
attempted to ignore one of these hints, this validation would occur
before the hint had been generated, so that comment would in turn appear
to be unnecessary.

If we need them to be ignorable, then we can special case them so that
they are never reported as being unnecessary.

And after running this over the Flutter repo I commented out two of the
three codes because there are violations. Many of the violations are
valid and need to be cleaned up. Some are the result of "ignore" being
used for other purposes. The Flutter team has said that we can replace
their use of "ignore" in order to enable these hints, but I don't have
time to do that right now and I'd like to get this landed before it bit
rots again.

Change-Id: I1704105621bef5a5c49202267c99aa1d950a26a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156402
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-10-18 16:53:06 +00:00
Konstantin Shcheglov b155af2442 Update documentation for ElementAnnotation.element
R=brianwilkerson@google.com

Change-Id: I166545cd2359370d2bfff5fdfaa36c5ce6950f52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168129
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-17 17:37:15 +00:00
Konstantin Shcheglov c4f2c8ec3e Remove commented out code from LinkedUnitContext.
Change-Id: Ie98122bfa5d9dfcf60f6ea3734a4c44c905ffee5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168128
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-17 16:52:35 +00:00
Konstantin Shcheglov 494eb72413 Implement AnalysisDriver.getErrors() using performWork().
One possible issue with not doing this is that we would not apply
changes reported as changeFile(path).

Change-Id: Ic88ec05f997c9f90c6bd877d4612f01a6086364d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168221
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-17 16:50:55 +00:00
Brian Wilkerson 9c70b5f5b8 Report invalid_annotation_target when the annotation is a getter
Bug: https://github.com/dart-lang/sdk/issues/43830
Change-Id: Ie7f57b56b75d7ad274fd1473e028ed62d0f08a2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168126
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-10-16 20:38:22 +00:00
Konstantin Shcheglov 6f6a507dee Use AbstractTypeSystemNullSafetyTest in nullability TypeSystem tests.
R=brianwilkerson@google.com

Change-Id: Ib239344c64e167e5d04030adf0576193d4da3c10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168124
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-16 18:38:12 +00:00
Konstantin Shcheglov 4d6fba37de Separate AST from resolution (per declaration).
Change-Id: Ic05781f98636e992c5c51d94cde51aa8c64663a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167242
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-10-16 16:33:42 +00:00