Commit Graph

7128 Commits

Author SHA1 Message Date
Devon Carew e7647f2cf2 Revert "[analysis server] remove the --file-read-mode cli option for the analysis server"
This reverts commit 1caee4d1fd.

Reason for revert: This breaks google3 - we need to update the linter's use of the analyzer API.

Original change's description:
> [analysis server] remove the --file-read-mode cli option for the analysis server
>
> Change-Id: Id07e3655cb4bcfc462ada0db8257e7cf584272f5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171101
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Devon Carew <devoncarew@google.com>

TBR=devoncarew@google.com,scheglov@google.com,brianwilkerson@google.com

Change-Id: I68294ad8b565a94aa098e65276b78e9745eec5a5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171640
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-11-11 20:10:41 +00:00
Devon Carew 1caee4d1fd [analysis server] remove the --file-read-mode cli option for the analysis server
Change-Id: Id07e3655cb4bcfc462ada0db8257e7cf584272f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-11-11 19:30:23 +00:00
Paul Berry cd05ad0009 Share and improve implementation logic of verify_tests_test.dart
This CL unifies the implementations of `verify_tests_test.dart` found
in packages `analysis_server`, `analyzer`, and `analyzer_plugin`.  It
also enhances the functionality of the tests by having them detect
both missing and extra imports in `test_all.dart` files.

This should make it easier to re-use this logic in other packages,
such as `nnbd_migration`.

Change-Id: Id344eeb4ad514461cda622495651b1339f379022
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170363
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-11-11 18:09:18 +00:00
Paul Berry 596198fb74 Share logic of package_root.dart
This CL unifies the implementations of `package_root.dart` found in
packages `analysis_server`, `analysis_server_client`, `analyzer`, and
`analyzer_plugin`.

This should make it easier to re-use this logic in other packages,
such as `nnbd_migration`.

Change-Id: I0da44edb379b8e929dd0b1c16a6989c1e9418acb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-11-11 18:09:18 +00:00
Sam Rawlins dc48399320 Analyzer: Introduce explicit casts required by null safety, in generated/
Change-Id: I7c7ad0abd906caf47fe9900b09b23e24b53cd4f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171441
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-11 17:33:53 +00:00
Konstantin Shcheglov a0227f5902 Issue 44063. Report IMPORT_OF_LEGACY_LIBRARY_INTO_NULL_SAFE hint.
Bug: https://github.com/dart-lang/sdk/issues/44063
Change-Id: I69c6f84da9a9c928e177507cedb30e06a561f3f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170441
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-09 19:42:08 +00:00
Sam Rawlins ae4e13a0a0 Analyzer: prepare for migration, mostly with explicit casts
Change-Id: Ic7565765d67a6b07c9028ad70f285cf0ed9de855
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170802
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-11-08 18:13:47 +00:00
Sam Rawlins 594f0fd51d Analyzer: Delete unused class in source_factory_test
Change-Id: Ia46e3cec3addc18c69259587d5186f9ec078cbfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170761
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-11-06 22:40:13 +00:00
Sam Rawlins 1b060fb77b Analyzer: prep for null safety with explicit casts, late hints
* `reference.hasElementFor` implies that `reference.element` is not null.
* Using `whereType` prevents an explicit cast from being needed.

Change-Id: I800f7183292ecd0bb6370a381b1d0b924b7f5a61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170744
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-11-06 22:07:43 +00:00
Sam Rawlins 466f2fd8a7 Analyzer: prepare some generated/ tests for null safety
Change-Id: Ieca714d8b32b7b283a8dc30dd820df07d1e64655
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-11-06 14:34:02 +00:00
Sam Rawlins 9e6486fe3f Analyzer: Make test fields late, late final, or hinted for migration.
Many fields can be late or late final, so adding hints for the migration tool.

In SnippetTester, the fields are all set in the constructor. Added a factory
constructor so the fields can be final. Renamed them to be private.

Change-Id: I559e7ba92c7c6749038630b03f67f8a77bdc704a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170406
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-05 17:45:17 +00:00
Sam Rawlins e56e5104cf Analyzer: prep file_system tests for null safety.
Fields initialized in `setUp` are late.

Variables initialized with implicit casts like:

    ClassDeclaration clazz = unit.declarations[0];

would need a cast:

    ClassDeclaration clazz = unit.declarations[0] as ClassDeclaration;

so they are updated to use var, which is more idiomatic:

    var clazz = unit.declarations[0] as ClassDeclaration;

Change-Id: I4e4ae814a814d3a4200c5078a6904dbac0a8140c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170520
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-05 17:39:37 +00:00
Konstantin Shcheglov 1726476120 Check for '!' operator when report HintCode.NULL_CHECK_ALWAYS_FAILS
Follow up for:
https://dart-review.googlesource.com/c/sdk/+/170122

Change-Id: If9b3cb1a18ecd7cf21149dbd0fda4ec209506b90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-11-04 03:43:25 +00:00
Jia Hao Goh 8c91d919b7 Treat integration_test/ as a directory for tests
This allows `invalid_use_of_visible_for_testing_member` to work with `@visibleForTesting` annotations when such symbols are accessed from an `integration_test/` package directory.

Bug: https://github.com/dart-lang/sdk/issues/43921
Change-Id: I530b88459060dbb05eb18d2a6de2902c88c246af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169180
Auto-Submit: Jia Hao Goh <jiahaog@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-04 00:26:15 +00:00
Konstantin Shcheglov c0c453f7f1 Issue 44029. Use the function type itself as the type of '.call'.
Presubmit in google3 looks green.
https://test.corp.google.com/ui#id=OCL:340480353:BASE:340480464:1604433051239:7c3180b

Bug: https://github.com/dart-lang/sdk/issues/44029
Change-Id: Ifc02615aa92da7ae0369ef55657cf6b0e9cdb0bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170200
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-03 19:59:07 +00:00
Sam Rawlins c6e4d6bcc8 Analyzer: new Hint: NULL_CHECK_ALWAYS_FAILS
This Hint reports when an expression of type Null is null-checked with `!`.
This check will always fail at runtime.

Fixes https://github.com/dart-lang/sdk/issues/43982

Change-Id: I6e2eac4f7b7720a6b9a1c02066470eb039aa9010
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170122
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-11-03 17:20:14 +00:00
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
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
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
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
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
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
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
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
Konstantin Shcheglov 94985b1178 Fix for crash when overriding a setter without parameters.
https://crash.corp.google.com/browse?q=product_name%3D%27Dart_analysis_server%27+AND+product.Version%3D%272.10.324558781-edge%2Bgoogle3-v2%27&stbtiq=&reportid=1f4a951a32533b7d&index=13#0

R=brianwilkerson@google.com

Change-Id: I7f96c67311e8f5e8698bead0d4d00b3968801c72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167903
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-16 16:16:03 +00:00