Commit Graph

33 Commits

Author SHA1 Message Date
Sam Rawlins 97cd131c9a analyzer: Introduce cannot-ignore analysis option.
Fixes https://github.com/dart-lang/sdk/issues/45404, which describes the option
in detail.

This removes all unfortunate exceptions for dart2js test code and for flutter
code. This removes the lateness of one final field.

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

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

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

Related to https://github.com/flutter/flutter/issues/52899

Change-Id: I054f487fafe2742ae57da1d2ccd2d52dce4188bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192560
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-24 13:32:49 +00:00
Sam Rawlins 82bcd13476 Change PubPackageResolutionTest to use null safety.
Some tests had some issues migrating to null safety that I
could not immediately hash out, or may warrant some more discussion.
So I've added WithoutNullSafetyMixin, and we can incrementally
migrate these after this CL.

Many tests have little no-op tweaks to make them null safe, like
initializing variables, adding late, making nullable.

Nest steps:
1. Remove `WithNullSafetyMixin` applications.
2. Remove `WithoutNullSafetyMixin` in every position with a TODO for
   #44666.
3. For every file with pair(s) of test classes (one pre-null safety,
   and one null safety), move around test cases so that they generally
   run with null safety, unless they are testing things very specific to
   before and after null safety.

Bug: https://github.com/dart-lang/sdk/issues/44666
Change-Id: I0512dedcda42e864fd580af4842702095937bdb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183140
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-08 23:06:04 +00:00
Sam Rawlins 56cf16887c Analyzer: Don't report on prefixed import with illegal references
Bug: TODO from https://github.com/dart-lang/sdk/issues/38784
Change-Id: I4ecdaf333c2613eb5fa0c57e4a8f8be56c35bb21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175184
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-12-07 01:27:25 +00:00
Sam Rawlins e0ebe30190 analyzer: Improve unused_import analysis for shared prefix names
Fixes https://github.com/dart-lang/sdk/issues/38784

Change-Id: I42b32261e9ed71018967e228d2ec731a4613205d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147336
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-12-03 04:00:37 +00:00
Konstantin Shcheglov 19652ae5ad Use binary format for summaries.
Change-Id: Ibf0221a3c233c958e5065b64207faf9dfae33083
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168260
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-12-01 21:30:35 +00:00
Konstantin Shcheglov c2379a800a Move more tests to PubPackageResolutionTest.
R=brianwilkerson@google.com

Change-Id: Ic6c37d069323cc06c6ab630757625a7e0b072200
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-06 22:30:39 +00:00
Konstantin Shcheglov 8de8a1c226 Move codes from StaticTypeWarningCode into CompileTimeErrorCode.
They are all errors now.

Change-Id: If48d38e38e845fd5b5a950dd5514bf1cbbce03d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-27 16:44:15 +00:00
Sam Rawlins 2c420267b7 analyzer: Do not allow errors to be ignored inline. Fixes #27218
Change-Id: If37dabba3ec18a9f79f44c4ea38d6920a4013019
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140142
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-04-10 17:16:24 +00:00
Brian Wilkerson ad021d02d4 Integrate the latest batch of reviewed diagnostic docs
This includes a small improvement to the validation tests, but there is
also one code whose docs can't be verified without additional work that
I will do in a follow-on CL.

It also includes splitting one code into two to improve the messages.

Change-Id: I52989ca336e42822327e3ac3805b1654d20a479c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125901
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-11-21 15:21:55 +00:00
Konstantin Shcheglov 963c338104 Don't use ResolverTestCase for two tests.
R=brianwilkerson@google.com

Change-Id: I375dfe9d9227d9a0cca50ed9ed5938620f9cfc50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-30 14:35:37 +00:00
Brian Wilkerson d0fda82493 Clean up some of the unused task model support in test code
Change-Id: I2a70070866e38377a4dd149b6407942e3f81c92d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98049
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-03-28 17:13:45 +00:00
Brian Wilkerson 4a7556840f Rename tests ending with Test_Driver
Change-Id: I1b4822630a2508e8a41ba6c5564eae5a54f56622
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96740
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-03-13 13:38:22 +00:00
Paul Berry c9b1877cbf Disable task model for clients by making WorkItem inconstructible.
The task model is still allowed in analyzer tests since we still have
some unit tests of non-task-model functionality that rely on the task
model to do their testing (see #35734).

Unit tests whose sole purpose was to test the task model have been
removed.  Test files that now empty have been removed.  Non-empty test
files that now contain no tests of their own have had their `main`
functions removed, and have been renamed so that the testing
infrastructure will no longer attempt to run them.

Change-Id: I8b4d0b2dde9337c4e1fe91e443a2c9da6eee8f4f
Reviewed-on: https://dart-review.googlesource.com/c/90720
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-01-24 16:29:17 +00:00
Konstantin Shcheglov 1f52372bfa Remove CFE integration from analyzer, analysis_server, and analyzer_cli.
AnalysisDriverResolutionTest is partially updated, about 30 failing
tests added. I will get back to it in a following CL, it is not
directly CFE integration, but updated understanding how we want to
resolve. For example we don't need types for non-expression identifiers.

Change-Id: I3daddbb6c66ffad7a726f3313a1199fd7387aa04
Reviewed-on: https://dart-review.googlesource.com/71883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-29 13:46:45 +00:00
Konstantin Shcheglov 8692936f48 Verify constants using Analyzer.
This fixes 44 failing language_2 tests.

Change-Id: I9248a940c56764d030e5cb1c8d558a3d41b88899
Reviewed-on: https://dart-review.googlesource.com/68340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-03 17:39:54 +00:00
Brian Wilkerson 873c4437c4 Update the failing tests in ErrorSuppressionTest_Kernel
Change-Id: I836bb62d35c19f5e95f2d763dd5e1bcfbf1aeca0
Reviewed-on: https://dart-review.googlesource.com/66100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-07-21 15:04:46 +00:00
Sam Rawlins b32a56235e Analyzer: fix 'ignore:' comments at the end of a line.
'//ignore:' comments that sit next to code should not invalidate errors on the
next line.

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

Bug: https://github.com/dart-lang/sdk/issues/28467
Change-Id: I15b1787e5fe4dadcdc72c18409e0b82df11060af
Reviewed-on: https://dart-review.googlesource.com/29548
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-12-18 20:07:56 +00:00
Brian Wilkerson 62d0376231 Run the sorter to reduce code churn
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2933753002 .
2017-06-12 07:37:14 -07:00
David Morgan 32c4094d04 Analyzer: add ignore_for_file comment that ignores a type of problem for the whole file; add tests.
BUG=
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2888953002 .
2017-05-19 10:01:53 +02:00
Paul Berry c6206ea1de Split "_Driver" tests to separate test files.
This avoids timeouts on my machine.  Also it makes it easier to disable these tests when necessary.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2627293002 .
2017-01-12 08:19:19 -08:00
Konstantin Shcheglov 73e7da4976 Run the most of error generating tests with the new analysis driver.
Some tests have more failures than I feel comfortable marking as failing.
I will triage them in following CLs.

StaticTypeAnalyzer2Test
StrictModeTest
StrongModeDownwardsInferenceTest
StrongModeStaticTypeAnalyzer2Test
TypePropagationTest

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2628743002 .
2017-01-11 08:25:21 -08:00
Konstantin Shcheglov 65ff5b5e50 Explicitly compute analysis results for sources to check errors.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2625783002 .
2017-01-10 12:58:58 -08:00
Konstantin Shcheglov 5a3afed30f Make error producing tests ansynchronous.
This is another preliminary test to run these tests with the new
analysis driver. Especially when we're going to replace the task based
analysis implementation with another one.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2624793002 .
2017-01-10 10:33:44 -08:00
Konstantin Shcheglov b5c5c1c222 Remove computeLibrarySourceErrors().
All errors are computed and validated in assertErrors().

In a 3 tests assertErrors() for the library was mved before the call
for a part to ensure library/part link establishment.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2626653002 .
2017-01-10 08:44:48 -08:00
Konstantin Shcheglov 5455fd0118 Remove 'initializeTestEnvironment' from 'analyzer'.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2399913002 .
2016-10-06 10:18:54 -07:00
Konstantin Shcheglov 175dad4f15 Switch 'analyzer' to 'package:test' and test_reflective_loader ^0.1.0.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2391423003 .
2016-10-06 08:46:35 -07:00
Brian Wilkerson ecc84b26a4 Break up another large file
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2342733002 .
2016-09-15 07:49:27 -07:00
Konstantin Shcheglov cc6beaf56d Pull in test_reflective_loader 0.0.4 and switch analyzer to it.
There are following changes:

1. DEPS to pull in test_reflective_loader 0.0.4
2. Rename runReflectiveTests() to defineReflectiveTests().
3. Remove analyzer's pkg/analyzer/test/reflective_tests.dart
4. Replace reflective_tests.dart imports with package:test_reflective_loader/test_reflective_loader.dart imports.
5. Sort/format and organize imports in the files with imports changes.
6. Fix for a couple of bugs in analysis_server exposed by the new loader.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2298913003 .
2016-08-31 13:46:39 -07:00
Paul Berry 2eed3a1de3 Fix "ignore:" handling with upper case error codes.
Problem was introduced in c77781d27e,
which inadvertently dropped a call to toLowerCase().

R=pquitslund@google.com

Review URL: https://codereview.chromium.org/2070553002 .
2016-06-15 06:30:44 -07:00
pq 6b20605984 Support ignores at end of line (#26181).
Implements: https://github.com/dart-lang/sdk/issues/26181

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1913113002 .
2016-04-22 11:06:16 -07:00
Bob Nystrom 8defa5f77c Split resolver_test.dart into smaller files.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1782463002 .
2016-03-09 10:42:09 -08:00
pq 51188b6601 Prettify ignore syntax (#25685).
Prettifies ignore syntax (`//# ignore:` => `//ignore:`).

More context: https://github.com/dart-lang/sdk/issues/25685

BUG=
R=brianwilkerson@google.com, ianh@google.com

Review URL: https://codereview.chromium.org/1738203002 .
2016-02-26 10:21:03 -08:00
pq 75b1379a0f Support for line-level error suppression (#25685).
Adds filtering logic to apply source-level error suppression using a simple comment convention.  For example, suppressing an invalid assignment would look like this:

```
//# ignore: invalid_assignment
int x = '';
```

Lists are supported as well:

```
//# ignore: invalid_assignment, const_initialized_with_non_constant_value
const String y = x;
```

Conversation on final format continues (https://github.com/dart-lang/sdk/issues/25685), so this can be treated as provisional but proves out the mechanics.  Comments and concerns most welcome.

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1702733002 .
2016-02-16 13:53:58 -08:00