Commit Graph

79 Commits

Author SHA1 Message Date
Brian Wilkerson 49437e3bae Split TooManyArguments to support quick fixes
Change-Id: I31511f619cafbce01f68d6e182328567a2bc3523
Reviewed-on: https://dart-review.googlesource.com/70021
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-08-15 13:24:22 +00:00
Brian Wilkerson 87f753dbd3 Replace some declarations of element with declaredElement
Change-Id: Idd62472b16cccaa98749a510197ec8d0f5053cb1
Reviewed-on: https://dart-review.googlesource.com/67820
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-08-02 16:00:36 +00:00
Paul Berry 31af5ce13c Revert CLs reworking generator class handling of non-lvalues.
This arc of work is breaking the Flutter roll--see
https://github.com/dart-lang/sdk/issues/33993.

This reverts the following commits:

- 55c0857037 (Create a common generator class to handle non-lvalues.)

- c9b197017c (Rename "assignment_of" -> "assignment_to".)

- 32fd7b15e4 (Remove special case for assignment to parenthesized
  expressions.)

- 432e59e589 (Fix error reporting if a for-in statement attempts to
  assign to a prefix.)

- 232bed3d11 (Change UnresolvedNameGenerator to use
  NonLvalueGenerator.)

- 0b778d0697 (Change IncompleteErrorGenerator to make use of
  NonLValueGenerator.)

- 1a5f94a0a4 (Fix analyzer-CFE integration of illegal references to
  instance members from static contexts.)

Change-Id: Id637e5ec60150a73031c05d7bb4c6effefd2aa8a
Reviewed-on: https://dart-review.googlesource.com/67091
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-07-27 17:18:28 +00:00
Konstantin Shcheglov 8c4b5be526 Update more expectations for kernel tests.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I9dad5a70e6620a45c5c52653453f1dccb17b17d0
Reviewed-on: https://dart-review.googlesource.com/66415
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-07-24 23:22:15 +00:00
Mike Fairhurst 9727a4a4ef Fix #33415 no error for awaiting a void expression.
Bug:  33415
Change-Id: I4d4e81fef79a5bc5162e37ab07a8fe99e50c8dfc
Reviewed-on: https://dart-review.googlesource.com/60522
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-07-24 19:31:57 +00:00
Brian Wilkerson 129dc3c984 Update the failing tests in StaticWarningCodeTest_Kernel
Change-Id: Iee593dfa0207299270e1af13840063336c038292
Reviewed-on: https://dart-review.googlesource.com/66341
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-07-24 13:19:24 +00:00
Brian Wilkerson 14b359fdb9 Map VoidExpression to an analyzer code
Change-Id: I18274a543b486ad874dd95d5dc7a16ecadb801d7
Reviewed-on: https://dart-review.googlesource.com/65563
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-07-18 16:30:20 +00:00
Brian Wilkerson ab1c1582b1 Remove deprecation hints in analyzer packages
Change-Id: I001e57239a87f2806be74052a5e7686245fea812
Reviewed-on: https://dart-review.googlesource.com/65000
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2018-07-17 15:22:07 +00:00
Konstantin Shcheglov 1c95390082 Store resolution for final fields that initialized multiple times.
Change-Id: Iee57f4540ad2ffeb66498f061f0cca77e53320ab
Reviewed-on: https://dart-review.googlesource.com/64661
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-07-12 17:41:28 +00:00
Devon Carew 2dd33c2a6c Have the package:analyzer strong mode option hard coded to on. Delete several spec mode only tests.
Change-Id: I5dffec68d9845fe75936d55100c03306b6eda363
Reviewed-on: https://dart-review.googlesource.com/64060
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-07-10 05:30:10 +00:00
Paul Berry 45eee81252 Check another case of StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC.
The analyzer was missing cases where the reference to the type
parameter was in an ordinary SimpleIdentifier, not part of a TypeName.

Fixes #21565.

Change-Id: I6be21b296c8c60777238c89a4e5e15a8c0ca8a6e
Reviewed-on: https://dart-review.googlesource.com/63660
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-07-03 19:58:31 +00:00
Brian Wilkerson 53525542cd Add tests for instance create of an abstract generic class
Change-Id: I040f30ed75e67fca0ef1bb1300d2a77bc27e417c
Reviewed-on: https://dart-review.googlesource.com/63520
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-07-03 17:42:15 +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
Janice Collins 1afe71c08a Enable preview-dart-2 as default for analyzer.
Based on https://dart-review.googlesource.com/c/sdk/+/52340, but adds
the necessary plumbing through the test system to pass through
negations to strong and preview-dart-2.  Also adds support for those
negations to the analyzer.

Change-Id: I9793ff28bb593d25bbb0a2ed8736b5b53e0a62d8
Reviewed-on: https://dart-review.googlesource.com/52461
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-26 17:01:12 +00:00
Konstantin Shcheglov 6865041334 Issue 27098. Check that argument is assignable to parameter in call().
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/27098
Change-Id: I0d5ac65202b632646bd7b26170c55ab985d2523c
Reviewed-on: https://dart-review.googlesource.com/52263
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-04-20 21:50:59 +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
Mike Fairhurst 7a0a9284ba Relax void errors: no error assigning void to void variable (+tests)
Change-Id: I1a6e80125dff6f766c9a74b760b557609a2544fb
Reviewed-on: https://dart-review.googlesource.com/40507
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-02-12 21:24:19 +00:00
Mike Fairhurst 56d59dd967 Reland https://dart-review.googlesource.com/c/sdk/+/37441 with fixes
Change-Id: If8e2ec2ca1ac4f533dcb56b0c95d55e4a13e0598
Reviewed-on: https://dart-review.googlesource.com/39881
Reviewed-by: Paul Berry <paulberry@google.com>
2018-02-08 20:46:19 +00:00
Mike Fairhurst ec58f5646a Revert "Make void a static warning to use almost everywhere."
This reverts commit 09eed74a8a.

Reason for revert: Too much SDK code is not yet compliant.

Original change's description:
> Make `void` a static warning to use almost everywhere.
> 
> Changed the hint to a StaticWarningCode, since that's the new spec'd
> error type and the hint is no longer needed.
> 
> Added a new set of methods to test the cases.
> 
> Didn't try to solve the problem generally ("all usages except ... are
> errors" means it easier, in theory, to make a ReportVoidExpressions
> style visitor that catches absolutely all types) because most of the
> work is actually about suppressing errors that are no longer needed.
> Ie, from NO_SUCH_METHOD to USAGE_OF_VOID_RESULT which means we have to
> put the void handling logic into each AST method specially anyway.
> 
> Some redundant tests removed.
> 
> Don't flag: ternaries, void -> void assignments, void returns in
> dynamic.
> 
> Change-Id: Ief8035dcfe582b36b6372180ddcf4e453d320d9c
> Reviewed-on: https://dart-review.googlesource.com/37441
> Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>

TBR=leafp@google.com,scheglov@google.com,mfairhurst@google.com

Change-Id: I13ee4c6939468d35506779ade637a040833632f4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/39848
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-02-07 22:32:51 +00:00
Mike Fairhurst 09eed74a8a Make void a static warning to use almost everywhere.
Changed the hint to a StaticWarningCode, since that's the new spec'd
error type and the hint is no longer needed.

Added a new set of methods to test the cases.

Didn't try to solve the problem generally ("all usages except ... are
errors" means it easier, in theory, to make a ReportVoidExpressions
style visitor that catches absolutely all types) because most of the
work is actually about suppressing errors that are no longer needed.
Ie, from NO_SUCH_METHOD to USAGE_OF_VOID_RESULT which means we have to
put the void handling logic into each AST method specially anyway.

Some redundant tests removed.

Don't flag: ternaries, void -> void assignments, void returns in
dynamic.

Change-Id: Ief8035dcfe582b36b6372180ddcf4e453d320d9c
Reviewed-on: https://dart-review.googlesource.com/37441
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-02-07 21:36:01 +00:00
Brian Wilkerson b74ceb0248 Remove a warning (issue 31351)
Change-Id: Id798aa7ece345970e3bfba15b260df6482a57074
Reviewed-on: https://dart-review.googlesource.com/37861
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-01-31 20:42:26 +00:00
Paul Berry 314b89e11d Update the analyzer to require noSuchMethod overrides to be concrete.
See 38dcb10543 for details.

Change-Id: I00608f7106e1b37cde81b8145d8d748f8cd97804
Reviewed-on: https://dart-review.googlesource.com/36520
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-01-24 13:55:18 +00:00
Leaf Petersen 53908b0790 Remove warning for "is" checks with generic type parameters.
The analyzer used to emit a warning when a type parameter to a generic
method was used in an "is" check.  This warning was there to help
users write code that worked correctly on both Dart 1.0 and 2.0.  Now
that 2.0 generic methods are being more broadly supported and used,
this warning is blocking further library work, and is being removed.

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

Bug:
Change-Id: I70395305ad082aee3072b5beeb0b1b7f7883391b
Reviewed-on: https://dart-review.googlesource.com/29821
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-12-15 18:12:03 +00:00
Sam Rawlins ee07335392 Improve message around re-assigning a local final.
Add a new ASSIGNMENT_TO_LOCAL_FINAL code for the new text.

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

Bug: https://github.com/dart-lang/sdk/issues/28721
Change-Id: I5492dd0d9ee09d5b73296b46fe10271661c3c64f
Reviewed-on: https://dart-review.googlesource.com/29621
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-12-15 01:09:55 +00:00
Erik Ernst 9336e199fd Re-land of CL 2990703002, adding fixes to analyzer_test and error_test.
This CL is identical to the reverted CL 2990703002 which implements
syntactic support for generalized void in the analyzer, plus two bug
fixes in pkg/analyzer/test/generated/parser_test.dart and
pkg/analyzer_cli/test/error_test.dart. In the former, a test on parsing
`void,` was changed to expect an error: _isTypeIdentifier on a lone
`void` will no longer return true, which is necessary because `void`
can now be used as a type annotation alone. Another test on `void x`
was added, which produces the behavior previously seen for `void,`.
In error_test, the error which is used throughout was changed from
`void foo;` to `var int foo;` (because the former is no longer an
error).

Review-Url: https://codereview.chromium.org/2992623002 .
2017-07-27 12:39:19 +02:00
Erik Ernst 2e73ce1187 Revert "Implemented support for generalized void in analyzer."
This reverts commit 1d44f5296a,
because it causes failures for the analyzer in parser_test, error_test.

Review-Url: https://codereview.chromium.org/2990723002 .
2017-07-26 18:18:04 +02:00
Erik Ernst 1d44f5296a Implemented support for generalized void in analyzer.
Changed the analyzer parser to accept usages of `void` which were
previously rejected as syntax errors: `void` can now be the type
annotation for a variable or parameter, and it can be an actual type
argument.

Removed affected error codes like VOID_PARAMETER, VOID_VARIABLE,
VOID_RETURN_FOR_GETTER and associated declarations (like checking
functions), and adjusted test cases to expect success rather than
compile time errors.

Adjusted generalized_void_syntax_test.dart (it had real errors like
`final` variables with no initializer etc. that were not detected
when tools would just reject the file as syntactically wrong).

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2990703002 .
2017-07-26 17:45:13 +02: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
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
Jennifer Messerly 613881a433 fix #29426, class type alias was missing checks
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2837173002 .
2017-04-24 15:02:29 -07:00
Brian Wilkerson 3dcf0e31c5 Split error code to ease future improvements
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2813553006 .
2017-04-11 13:35:38 -07:00
Leaf Petersen e40f878abc Restore weak mode errors on empty returns in Null functions.
Fixes https://github.com/dart-lang/sdk/issues/28668 .

BUG=
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2752423003 .
2017-03-17 14:30:42 -07:00
Konstantin Shcheglov 4cd790abe3 Record isFinal for parameters into summaries.
Found this out while running shared tests with the new analysis driver.

R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2657583007 .
2017-01-25 15:08:37 -08:00
Konstantin Shcheglov b8ab9b7e17 Fix tests to run with the new analysis driver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2656783002 .
2017-01-25 06:58:24 -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 799296e92b Extract x_Driver tests that time out on Windows bots.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2623253003 .
2017-01-11 11:49:34 -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 a3e1a0d395 Enable generic method support by default
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2488043002 .
2016-11-22 09:16:19 -08:00
Brian Wilkerson 6ce2f220e3 Add an error when a type parameter from a generic function is used in an is test
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2479293004 .
2016-11-09 07:47:54 -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
Sam Rawlins e60c1e4c59 Add an UNDEFINED_IDENTIFIER_AWAIT warning
BUG=https://github.com/dart-lang/sdk/issues/22625
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2156003004 .
2016-07-18 09:45:36 -07:00
Brian Wilkerson 8c244f03ad Report when members indirectly inherited through a mixin are not implemented (issue 26411)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1951363003 .
2016-05-06 11:29:44 -07:00
Brian Wilkerson 974385bb48 Add a failing test for generic tear-offs
R=leafp@google.com

Review URL: https://codereview.chromium.org/1933783002 .
2016-04-29 10:10:10 -07:00
Brian Wilkerson deae702994 Format everything in analyzer
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1842563003 .
2016-03-28 18:16:43 -07:00