Commit Graph

34 Commits

Author SHA1 Message Date
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
Brian Wilkerson 07850a6562 Remove false positive from override hint
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2228233003 .
2016-08-10 06:12:41 -07:00
Konstantin Shcheglov cc290c1dc0 Fix for false positive in field (not-)overriding.
Fields can also override setters.

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

Review URL: https://codereview.chromium.org/2174423005 .
2016-07-25 22:49:01 -07:00
Konstantin Shcheglov 7808f167ec Issue 26787. Report HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER for non-overriding fields.
R=pquitslund@google.com, brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/26787

Review URL: https://codereview.chromium.org/2182773002 .
2016-07-25 15:02:27 -07:00
Sam Rawlins 6e58ff0575 Do not error on dead, mandated statements at end of switch cases
BUG=https://github.com/dart-lang/sdk/issues/26673
R=brianwilkerson@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org/2064203002 .
2016-06-15 09:24:32 -07:00
Paul Berry 7653369e50 Fix exit detection for try statements.
Previously, we assumed that if the contents of the "try" block always
exit, then the whole try statement always exits.  But this is not
correct if there is at least one catch handler that does not exit.

Fixes #26676

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2054323002 .
2016-06-11 06:06:43 -07:00
Sam Rawlins 38e8d9702b Revert "Revert "If an if or do statement always exits, following statements are dead.""
This reverts commit c0b0c7be81.

BUG=https://github.com/dart-lang/sdk/issues/16420
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2007933002 .
2016-06-02 15:25:08 -07:00
Sam Rawlins c0b0c7be81 Revert "If an if or do statement always exits, following statements are dead."
This reverts commit d7833e1c1f.

BUG=

Review URL: https://codereview.chromium.org/2004223002 .
2016-05-23 15:15:05 -07:00
Sam Rawlins d7833e1c1f If an if or do statement always exits, following statements are dead.
BUG=https://github.com/dart-lang/sdk/issues/16420
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1943443002 .
2016-05-23 13:20:48 -07:00
Konstantin Shcheglov 1075e3a32e Clean up reporting HintCode.UNUSED_SHOWN_NAME when a prefixed top-level function is invoked.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1882633002 .
2016-04-12 13:31:40 -07:00
Brian Wilkerson d779eee74c Stop reporting use of deprecated members from within deprecated members (issue 25966)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1797593003 .
2016-03-13 13:57:36 -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