Commit Graph

61 Commits

Author SHA1 Message Date
Brian Wilkerson 52608e3174 Convert more tests to DriverResolutionTest
Change-Id: Ib1c3018362f868626d788bc63ba33e5fe5900d8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101001
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-05-01 17:02:19 +00:00
Brian Wilkerson 830ec419b6 Cleanup warnings and sort a few files
Change-Id: Ie781e1dff7eb079311b833d4a13f7a1d38ef0515
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98603
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-04-03 17:51:36 +00:00
Sam Rawlins 75b2f9f919 Move more HintCode tests to individual files:
* DUPLICATE_IMPORT
* IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION
* NULL_AWARE_*
* OVERRIDE_*

This puts non_hint_code_test alllllmost at empty.

Change-Id: Iade3a2fd29b484d711556ff688a6386789a50d0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98289
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-04-01 16:54:55 +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
Brian Wilkerson 68ad94cebe Extract more hint tests into separate files
Change-Id: I110f815c6bb124596b31cf3bac739ed8604d6c3b
Reviewed-on: https://dart-review.googlesource.com/c/89100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-01-11 15:39:16 +00:00
Sam Rawlins 9dbb6fb113 Add a Hint enforcing contract of @literal
Example code:

```dart
import 'package:meta/meta.dart';

class A {
  @literal
  const A();

  @literal
  const A.named();
}

var a = A();
var b = const A();
const c = A();
var d = new A();

var e = new A.named();
```

Produces:

Analyzing b.dart...
  hint • This instance creation must be 'const', because the A constructor is marked as '@literal' at b.dart:11:9 • non_const_call_to_literal_constructor
  hint • This instance creation must be 'const', because the A constructor is marked as '@literal' at b.dart:14:9 • non_const_call_to_literal_constructor
  hint • This instance creation must be 'const', because the A.named constructor is marked as '@literal' at b.dart:16:9 • non_const_call_to_literal_constructor
3 hints found.

Bug: https://github.com/dart-lang/sdk/issues/34259
Change-Id: Iba10e5e0a0b2d0f7e99556cd6c201cea229ad675
Reviewed-on: https://dart-review.googlesource.com/c/88422
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-01-08 17:20:05 +00:00
Brian Wilkerson 555485c891 Start splitting out the tests for hint codes
Change-Id: I2d221aa024b6db9426d7adf6b38c17da0be599d9
Reviewed-on: https://dart-review.googlesource.com/c/88541
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-01-07 14:25:20 +00:00
Sam Rawlins ce256c762c Impl of INVALID_LITERAL_ANNOTATION
Bug: https://github.com/dart-lang/sdk/issues/34259
Change-Id: Ia5ca627a89dcb3f0fcd5ce74048df8fdf9dd9c9c
Reviewed-on: https://dart-review.googlesource.com/c/88283
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-03 18:07:44 +00:00
Brian Wilkerson 737209b85c Remove some unused hint codes
Change-Id: I1388355e7832dec17ed06da14262573ea4e60eef
Reviewed-on: https://dart-review.googlesource.com/c/88161
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-12-31 16:23:28 +00:00
Paul Berry 32a6032f03 Merge commit 'ddbe22190c41b1993a3c93b67f1bfa57287348f8' into analyzer 2018-11-16 12:01:38 -08:00
Konstantin Shcheglov 8414e2240c Don't report DEPRECATED_MEMBER_USE for deprecated mixins, top-level variables, and class fields.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ied5fbe5f7427d286a43902719eb153964c8800e0
Reviewed-on: https://dart-review.googlesource.com/c/84545
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-15 20:35:57 +00:00
Brian Wilkerson 22408c6dee Remove references to previewDart2
Change-Id: Id382dd95d3ae90d483467741b5b6d3dbc6c31ea1
Reviewed-on: https://dart-review.googlesource.com/c/83300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-07 14:52:37 +00:00
Konstantin Shcheglov f5758b74c8 Report missing '[]' and '[]=' operators separately.
R=brianwilkerson@google.com

Change-Id: I729d76c3373ab0eba3e191a5a79f6d2a34a97e23
Reviewed-on: https://dart-review.googlesource.com/c/81222
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-23 15:46:51 +00:00
Konstantin Shcheglov c44fa48f8f Extract and rewrite MethodInvocation resolution.
This is a copy of https://dart-review.googlesource.com/c/sdk/+/78182,
but now in the analyzer branch.

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I75d17a351ee7a33c164d560009cf3ffd088d956a
Reviewed-on: https://dart-review.googlesource.com/c/80942
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-22 03:36:30 +00:00
Brian Wilkerson 469e1e2e64 Remove unnecessary library directives
Change-Id: I7a157080e4d7fd80d64489a13de4e996b5870930
Reviewed-on: https://dart-review.googlesource.com/c/79474
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-13 00:44:04 +00:00
Konstantin Shcheglov efcca1132b Switch ErrorVerifier and OverrideVerifier to InheritanceManager2.
R=brianwilkerson@google.com

Change-Id: I2f1f03684611fcd6a183ea494d3b3d71a67fb170
Reviewed-on: https://dart-review.googlesource.com/c/79181
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-11 14:48:18 +00:00
Konstantin Shcheglov 3daa63bc4c Revert OverrideVerifier back to the old InheritanceManager.
This partially reverts https://dart-review.googlesource.com/c/sdk/+/77521

There is still one pre-existing issue, will be fixed later.

R=brianwilkerson@google.com

Change-Id: Ide556a65ef2e46f1621ac60b1b7a32207d804b31
Reviewed-on: https://dart-review.googlesource.com/c/77920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-03 19:23:05 +00:00
Konstantin Shcheglov 9185294e7a Reland: Implement inheritance/override checks from the spec.
Relands https://dart-review.googlesource.com/c/sdk/+/76061
Was reverted in https://dart-review.googlesource.com/c/sdk/+/76301

The difference with the original CL is that we don't look into
superclass and mixins of mixed-in for concrete members. This reduces
the number of errors in Flutter codebase to 1.


R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/34392
Change-Id: I86256b598d116439194cbaf4d09b4f72013d6563
Reviewed-on: https://dart-review.googlesource.com/76340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-25 18:51:04 +00:00
Zach Anderson 95d37b0921 Revert "Implement inheritance/override checks from the spec."
This reverts commit 836a1d7a88.

Revert "Don't use ClassElementImpl for now in override checking."

This reverts commit 58e44c1400.

Revert "large_class_declaration_test is slow now."

This reverts commit 56f6c52d58.

Revert "Add regression test for issue 34392."

This reverts commit ef7d144bc7.

Revert "Mixin declarations don't have supertype, fix isMoreSpecificThan()."

This reverts commit 95b8a19a20.

Change-Id: Icda9cf9091ef35acc8fd61ac5dc135b3717eba0a
Reviewed-on: https://dart-review.googlesource.com/76301
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-09-24 21:27:34 +00:00
Konstantin Shcheglov 836a1d7a88 Implement inheritance/override checks from the spec.
This CL starts moving checks from strong-mode specific checker,
and old InheritanceManager into an implementation that is based
on the current spec, and avoids old baggage. It also fixes the issue
we were asked to fix for Dart 2.1.

Bug: https://github.com/dart-lang/sdk/issues/34392
Change-Id: Id5a23c5db7704b2b530bb894ae92628a08eaa70f
Reviewed-on: https://dart-review.googlesource.com/76061
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-24 16:28:50 +00:00
Konstantin Shcheglov f89053aecc Report ABSTRACT_SUPER_MEMBER_REFERENCE as error.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/33662
Change-Id: Ic80386c20acd2cd1ceebeb90fbb1d6e18982b024
Reviewed-on: https://dart-review.googlesource.com/74499
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-12 17:07:18 +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
Sam Rawlins 761178e471 Fix DEAD_CODE issue when break label is found inside a for-each.
Fixes #31714.

Bug: https://github.com/dart-lang/sdk/issues/31714
Change-Id: I36580a16604765497ee117625cb0b035603a69f3
Reviewed-on: https://dart-review.googlesource.com/69281
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-10 19:39:13 +00:00
Brian Wilkerson a486776e73 Update the failing tests in NonHintCodeTest_Kernel
Change-Id: If6b474b8bdcb888cef9fb16444f2dc5fa948a7e0
Reviewed-on: https://dart-review.googlesource.com/66183
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-07-23 20:56:59 +00:00
Leaf Petersen 8e9e8e1da0 Fix various bugs and regularize behavior of returns statements in
various kinds of functions.

Closes-bug: #31887
Closes-bug: #30638
Closes-bug: #32233
Closes-bug: #32881
Closes-bug: #31278
Change-Id: I4ebd7e71096d611e189b571ba5de2998dd11c98b
Reviewed-on: https://dart-review.googlesource.com/60300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2018-06-15 16:07:44 +00:00
Brian Wilkerson c0f2721e85 Use the type system to compare types (issue 30897)
Change-Id: I6ae706255bcf09276627a9e27fe2f12ea15bb203
Reviewed-on: https://dart-review.googlesource.com/54715
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-11 23:04:33 +00:00
Brian Wilkerson e9cdb5d4a8 Convert more analyzer tests to pass under preview-dart-2
Change-Id: Id2c7069da725db2d2572507fb73b51f5ab574d8a
Reviewed-on: https://dart-review.googlesource.com/46571
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 17:25:54 +00:00
Brian Wilkerson 8819d9fe98 Update analyzer tests for preview-dart-2, part 1
Change-Id: I3440607f7b3892193e1d9883709a1b9d4a7463d9
Reviewed-on: https://dart-review.googlesource.com/46562
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 16:45:04 +00:00
Brian Wilkerson 5eb6d980b5 Do not hint when using a deprecated parameter in the defining function (issue 32468)
Change-Id: I71de5c121add7bca7faa0875573e27f17f672e44
Reviewed-on: https://dart-review.googlesource.com/45840
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-09 19:09:08 +00:00
Brian Wilkerson de88ea0994 No hint when no return from Future<void> and async method
Change-Id: Ic925509b1b262d54712f8e9d4bdd7e8df211ed5e
Reviewed-on: https://dart-review.googlesource.com/43882
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-02-26 22:14:47 +00:00
Brian Wilkerson 86b27dd577 Add a hint for unused labels (issue 31930)
Change-Id: I0d2f41fdb8a7399e6664dcf57503de84991c075d
Reviewed-on: https://dart-review.googlesource.com/36181
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-22 18:34:28 +00:00
Brian Wilkerson fbe4151da4 Handle member references that cannot be resolved because of missing type information
Change-Id: I3599846476c082a533882f6d8d18e1adeb70fa3c
Reviewed-on: https://dart-review.googlesource.com/28383
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-12-11 22:21:53 +00:00
Sam Rawlins 0a6253312f Check for @alwaysThrows when evaluating for dead code.
The meta package version 1.1.0 includes a new `alwaysThrows`, which developers
can use to annotate methods that always throw. This helps to avoid erroneous
DEAD_CODE warnings from analyzer.

Bug: https://github.com/dart-lang/sdk/issues/31384
Change-Id: I70e2469b4f3a0d2c87064851160b268ea2259807
Reviewed-on: https://dart-review.googlesource.com/26563
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-12-07 19:29:18 +00:00
Konstantin Shcheglov 00d5012906 Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt.
...instead of mixing formatting with actual changes in many CLs.

R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2975253002 .
2017-07-13 16:28:18 -07:00
Konstantin Shcheglov 0160332713 Issue 28027. Move Null to the bottom in the Analyzer.
R=brianwilkerson@google.com, paulberry@google.com
BUG= https://github.com/dart-lang/sdk/issues/28027

Review-Url: https://codereview.chromium.org/2638183002 .
2017-01-18 11:15:11 -08: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 9d240f8fb1 Replace reset() arguments with resetWith() invocation.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2627083003 .
2017-01-11 13:37:22 -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
Brian Wilkerson 40cbb6ec15 Disable the hint produced when invoking a super member that is abstract when super-in-mixins is supported
R=paulberry@google.com

Review URL: https://codereview.chromium.org/2500143002 .
2016-11-14 13:51:35 -08:00
Paul Berry 0a1fb8d248 Move scanner into pkg/front_end/lib/src/scanner.
Several support classes also had to move to front_end along with the
scanner.  Some of these support classes arguably don't belong to the
scanner itself, since they have other uses (e.g. SyntacticEntity,
ErrorCode, ErrorSeverity, ErrorType, and StringUtilities).  They will
be reorganized into a more appropriate location in future CLs, at the
time that they become needed by other components of the front end.

In order to avoid dragging in a lot of dependencies, the following
changes were made:

1. Scanner no longer reports errors through Source and
AnalysisErrorListener objects passed to the constructor.  Instead, it
provides an abstract reportError() method which clients may override
to perform error reporting in any way they wish.  Analyzer contains an
override of Scanner that mimics the old behavior in order to maintain
compatibility.

2. Static members of ErrorCode (`values` and `byUniqueName`) have been
moved to top level, and remain in analyzer.  To maintain
compatibility, these static members remain in ErrorCode (as deprecated
members that simply wrap the implementations in analyzer).  This means
we have a reverse dependency (front_end depends on analyzer), but this
dependency will go away as soon as we publish the next breaking change
release of analyzer.

R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2486873003 .
2016-11-08 13:47:17 -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
Brian Wilkerson 79f190cf69 Supress deprecation warnings in a deprecated library
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2261053002 .
2016-08-21 15:47:38 -07:00