Commit Graph

66 Commits

Author SHA1 Message Date
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
Brian Wilkerson 513433d514 Sort analyzer sources
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1843473002 .
2016-03-28 17:41:52 -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
Bob Nystrom 4af641864f A missing enum case in a switch is a warning, not a compile-time error.
Fixes #25576.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1644683002 .
2016-01-28 11:12:25 -08:00
Brian Wilkerson f0d249e269 Clean up package imports and library names
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1513643009 .
2015-12-10 08:11:56 -08:00
Brian Wilkerson cc8f64b824 Do not generate warnings when noSuchMethod is inherited (issue 24337)
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1414003003 .
2015-10-20 10:35:53 -07:00
pq 67e988bb9f No more warnings for duplicate unnamed lib imports
Fixes #24156.

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

Review URL: https://codereview.chromium.org//1305433005 .
2015-08-20 14:30:37 -07:00
Brian Wilkerson 908708d655 More fixes for failures on the Windows bot
R=paulberry@google.com

Review URL: https://codereview.chromium.org//1266923004 .
2015-08-05 08:13:28 -07:00
Konstantin Shcheglov 96670b0e97 Fix for explicit dart:core import.
This fixes the rest of the co19/ tests.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1181663004.
2015-06-12 13:26:12 -07:00
Konstantin Shcheglov 9634a03393 Explicitly compute library errors in tests.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1183723002.
2015-06-12 12:28:24 -07:00
Paul Berry fc83ce5ba9 Fix analyzer's handling of import prefixes not followed by '.'.
If 'p' is an import prefix, then 'p = ...' is treated as synonymous
with 'this.p = ...', and 'p()' is treated as synonymous with
'this.p()'.  In all other circumstances where 'p' is not followed by
'.', the spec calls for a compile time error.

Previous to this CL, 'p' not followed by '.' was being treated as
synonymous with 'this.p' under all circumstances.  This CL brings
analyzer in line with the spec, and updates the tests in
tests/language accordingly.

The VM and Dart2js currently fail to implement the compile-time error
properly.  See issues #23611 and #23612.

Fixes issue #23461.

R=scheglov@google.com

Review URL: https://codereview.chromium.org//1173523002.
2015-06-09 13:38:53 -07:00
paulberry@google.com 5677e52ad6 Generate warnings for assignment to a type.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1042133002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44774 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-30 00:08:17 +00:00
scheglov@google.com ef2a41217d Add NOT_INITIALIZED_FIELDS property for FINAL_NOT_INITIALIZED_CONSTRUCTOR_X.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1004793003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44511 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-16 17:49:19 +00:00
brianwilkerson@google.com 98b7382071 Reformat
R=paulberry@google.com

Review URL: https://codereview.chromium.org//975453004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44149 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 21:34:46 +00:00