Commit Graph

470 Commits

Author SHA1 Message Date
Brian Wilkerson 46c042a118 Improve a diagnostic message by unwrapping Future (issue 39561)
Change-Id: Ie74200e8f41aa70c33f5d7a62c8d0a0ae7a96146
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126700
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-11-29 16:08:46 +00:00
Brian Wilkerson 3663abd8db Update the header in the generated diagnostic docs
Change-Id: I2dbf01bbde39029d06aa19fd5c6cd9d80cd3e06b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126241
Commit-Queue: Kathy Walrath <kathyw@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
2019-11-26 00:37:53 +00:00
Konstantin Shcheglov dcaf959589 Fix several unused elements, and unnecessary casts.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I81559cb241c0ca6918f6730538f44a7411907867
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125986
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-11-21 21:37:52 +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
Brian Wilkerson 1f933abcee Convert a compile time error into a parse error (issue 39389)
Change-Id: I115c7bb4ab05f8c6e9ddc566985126a1b9a09842
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125621
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-11-19 18:25:29 +00:00
Brian Wilkerson c96fe4e006 Add more explaination to existing examples
Change-Id: I2f89ef54eb4467d23f7507c1217385a1df2d4a11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124594
Commit-Queue: Kathy Walrath <kathyw@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
2019-11-16 02:52:18 +00:00
Johnni Winther a996783de5 [cfe+analyzer] Move StackListener to _fe_analyzer_shared
Change-Id: I7e0ebef15b904afc14ed3b1c0f72cde5389d9c59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123730
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-02 11:21:49 +00:00
Johnni Winther 00c2962db8 [cfe+analyzer] Move messages, scanner and parser to package:_fe_analyzer_shared
Change-Id: I4fa87aee65f30a9868a6cf8f0342591869ece7ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123663
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-01 09:37:57 +00:00
Brian Wilkerson df8876582c Include all variations of a message in diagnostic docs
We now have multiple messages for the same name (id) and all of the
messages should be included in the docs so that users aren't confused
when the message they see doesn't match what's documented.

Change-Id: I0f668ececae1e9852eff9db25f29a48b7414c4d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123141
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-10-28 15:55:31 +00:00
Sam Rawlins 9cc57416be Change error node for MISSING_RETURN to be the name
Fixes #35607

Change-Id: I66b9921b0ede5370364b89a89fb19bf0df96ac97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122726
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-24 19:42:07 +00:00
Konstantin Shcheglov 8b1e73d15d Remove lazy FunctionTypeImpl.
Change-Id: I9dad79468560f1b4c4be793ba51105acf19f05d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122721
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-10-24 17:27:32 +00:00
Sam Rawlins 3778839976 Fix version number that first supports ui-as-code; fixes #37898
Change-Id: Iaaec4dedbe8f9b2b5331fa9c69c39d5032383d75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113743
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-10-15 19:35:49 +00:00
Jens Johansen 8f477fd84a [parser] Disallow covariant on extension method parameters
Fixes #38560.

Change-Id: I4c941fb6713983cc01efbe143c7924d0643efe73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119332
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-08 13:01:40 +00:00
Konstantin Shcheglov ad47b1ca64 Remove summary1, part 2.
Change-Id: I050b62bbbd77db6bd6a2d815e70cfe92cc9432a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119220
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-10-07 17:35:55 +00:00
Brian Wilkerson 04910d62f5 Include the deprecation message in diagnostics (issue 38667)
Change-Id: Ib1fa24fa4b112b9675d1f1900cbdda15319080a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119780
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-04 16:27:07 +00:00
Konstantin Shcheglov 3f65652ad0 Enable avoid_init_to_null.
R=brianwilkerson@google.com

Change-Id: I983fdff71c47dbf2b271508955095a73cfbeee59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-30 14:26:06 +00:00
Konstantin Shcheglov 595022bdea Remove summary1, part 1.
Change-Id: I557785ac13fa411280ce032324b0305bf25a0a6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119170
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-28 14:30:05 +00:00
Brian Wilkerson 61b4c0f770 Cleanup hints and lints in analyzer packages
Change-Id: I7f1a6ad1ed3610da9616683576ebfb5efd543fd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119164
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-09-27 16:12:44 +00:00
Brian Wilkerson 3c18db7d9e update analyzer error message generator to generate hasPublishedDocs
Change-Id: I87fae43033876c84448e785417bd5a72efe52ef9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118180
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-09-26 17:11:02 +00:00
Brian Wilkerson a2803a1b2d Add documentation for more diagnostics
Change-Id: I8270a74cc5a70dd16a46e3a7b2ff2bb822b69fb3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118820
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-09-25 16:38:06 +00:00
Brian Wilkerson 139889e2b9 Fix a couple of diagnostic messages and re-order several constants to restore alphabetic ordering
Change-Id: Ifb853a1ae6b9b22e2f8e65c304b43ba2b8b895d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117161
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-09-13 15:58:42 +00:00
Brian Wilkerson c74e68e501 Add documentation for more diagnostics
Change-Id: Id2aeb13db0ceb81fc18d67e6ef2778304b36d02b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117000
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-12 16:35:46 +00:00
Konstantin Shcheglov e8836f5086 Fix sample for UNDEFINED_SETTER.
R=brianwilkerson@google.com

Change-Id: I9c897ee5890d4b951cf157a5da6c21a5505248d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116823
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-11 21:20:57 +00:00
Brian Wilkerson d36f5ed181 Fix diagnostic documentation tests and add support for documenting parser codes
Change-Id: Ie2e360e6e4a344888bb409d20f21c969280bbdf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116742
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-09-11 19:45:47 +00:00
Brian Wilkerson a94a3c60d7 Format the code snippets in docs
Change-Id: Ieabed8b05df79b4872090e82cdc6ceb941979e71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115060
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kathy Walrath <kathyw@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
2019-08-30 16:38:14 +00:00
danrubel 6061906a77 split endMethod into 6 separate events
This updates the parser to detect constructors vs methods
in classes vs mixins vs extensions. Rather than generating a single
endMethod event and require listeners to determine the type of
declaration, the parser now generates different events for
different types of declarations so that listeners can process
each of these different types separately.

In addition, this lays the groundwork for fixing extension declaration
error messages and moving error generation that is duplicated
in the various listeners into the parser.

Change-Id: Ia86a4bf3e6f1442ca4926c754b66e7d6e86fb47d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-30 00:33:43 +00:00
Brian Wilkerson 7eecb77b0f Minor updates to the diagnostic docs
Attempt to fix the link to the glossary and consistently place 'keyword'
after the name of the keyword in text.

Change-Id: Ib5f75568bdea0a875d1829ab52cbe93894e7f595
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114742
Commit-Queue: Kathy Walrath <kathyw@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
2019-08-28 17:29:01 +00:00
danrubel 7b37cddbe8 rename ClassKind to DeclarationKind
... and add DeclarationKind.TopLevel

Change-Id: I631c0173a056e856845f02d4415c11336a796e3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114629
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-28 00:57:42 +00:00
danrubel aeb5e732fd split endClass/Mixin/ExtensionFactoryMethod event
This separates an existing parser event into 3 separate events
based upon the enclosing declaration so that listeners
can process them differently in future CLs.

Also address comment in https://dart-review.googlesource.com/c/sdk/+/114564

Change-Id: I07b259d02bd16257edf47eb76cbdd0d022f808dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-27 17:54:52 +00:00
Jens Johansen 74e09abc6e [CFE] Remove/move file that wasn't needed by frontend; cleanup pubspec.yaml a bit
Change-Id: I204b844e7f1cb892a529bca3a13017ed836275f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114074
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-08-23 07:42:03 +00:00
Johnni Winther 6eb9f54683 [cfe] Add ClassKind to Listener.begin/endClassOrMixinBody
This allows for special-casing extension declarations bodies. This
is needed because the on-clause hold the type of the parameter holding
the `this` value inside an instance method in an extension declaration.

Change-Id: I7af9bf0a9842f7e6f42dddb54fb487c69a8fa519
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111729
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-08-05 17:15:37 +00:00
Brian Wilkerson d2f1dde3c7 Merge two codes, improve some messages, and general code cleanup
In retrospect I probably should have made this three separate CLs, and
I'm happy to go back and do so if you'd prefer.

Change-Id: I816bbbc16794c86129c9b6501db4a5dce2a8e199
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110480
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-07-26 18:25:21 +00:00
Brian Wilkerson fbcbb83cab Add documentation for more diagnostics
Change-Id: I57b69e5e16c7b6effb369e49556fc744976b04e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110201
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-07-25 17:15:34 +00:00
Brian Wilkerson 4fc387f27e Update doc the generator to convert code blocks
Change-Id: I7b5b6c42d700762bf82331113f90091754283534
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109620
Reviewed-by: Kathy Walrath <kathyw@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-07-19 17:51:10 +00:00
Brian Wilkerson d32a4dbe57 Minor updates to existing docs
These are based on recent comments, and might not be appropriate.

Change-Id: I634dc30a29459f3ab41dae99233d27c9954b9347
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109542
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
2019-07-18 15:43:55 +00:00
pq 8f90265176 de-lint collection size checks
Change-Id: Id8e7ce2ec59ad7cd2b0b9c961594a37d4fef621a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108522
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2019-07-10 13:46:43 +00:00
Brian Wilkerson 3a8d755989 Change the delimiters used to mark highlight ranges in diagnostic documentation
Change-Id: I4eb2c44ea4eb2a054eccbb4a6ab64a01d2866042
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108506
Reviewed-by: Kathy Walrath <kathyw@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-07-09 22:12:07 +00:00
Vyacheslav Egorov a86db84e0a [fasta] Preserve information about const constructors in outline.
- for classes with const constructors parse field initializers;
- for const constructions parse initializer lists and default parameter
values;

Fixes issue https://github.com/dart-lang/sdk/issues/37357
Fixes issue https://github.com/dart-lang/sdk/issues/36635

Change-Id: Iff0e47f8bd2925cee9f42a2b309de4de84e99cad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108279
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-09 14:02:01 +00:00
Brian Wilkerson d914839ce6 Add tests for diagnostic docs
This tests that the docs have been generated and that the code samples
in the docs generate the expected errors at the expected locations.

Change-Id: Iff254537c15c58d6c5dde2bb2bb739e52f156b50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108320
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-07-08 13:36:14 +00:00
Vyacheslav Egorov 9f32f9b87e [cfe] Store the initializer tokens in constructor builders
For const constructors, we need to compile the initializer expressions
and write them into the outline so that we can perform modular
constant evaluation.  As a first step, preserve the tokens for the
initializer expressions in const constructor builders when building
the outline.

Currently they are discarded later during outline building at the
point when we should compile them instead.

Change-Id: Ief8d94ceb752b2315982d720836496b7d597e55c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107509
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-03 10:52:35 +00:00
Brian Wilkerson f897a940c1 Fix minor nit in documentation
Change-Id: I0a75ecce970754b036f2af0a065aa392547dae7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106322
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-06-17 16:19:09 +00:00
Brian Wilkerson c5cd37e727 Address more documentation feedback
Change-Id: I2e55e146495ab8bd59e87cff9915ee84c99da8b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-06-15 15:30:40 +00:00
Brian Wilkerson a02d6de474 Update documentation based on addition feedback from the documentation team
Change-Id: If028f6f3a81a827537642da9f261001588f67bf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106120
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-06-14 17:09:37 +00:00
danrubel 6bd64ff8b2 cleanup StringScanner references
Change-Id: Ic75305c7a76860c5b96032d4f8c8fff695006f22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106004
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-14 13:39:47 +00:00
danrubel 1a9801e9fa mark ExperimentalFeature bogus_enabled and bogus_disabled as deprecated
... and update comment and test output to indicate how files should be
regenerated from tools/experimental_features.yaml

Change-Id: I369b93c35b91f7a93c915f0abf9cebdd00c13f8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106003
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Dan Rubel <danrubel@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-06-13 21:30:05 +00:00
Brian Wilkerson e6567601af Add a notice that the markdown file is generated and remove documentation specific to nnbd
Change-Id: Iece4cd98399b243c9d7fb69af888460bb45421fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105600
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-06-11 19:57:19 +00:00
Brian Wilkerson 9559e4d444 Initial documentation for a small sample of diagnostics and a script to generate a markdown file containing that documentation
Change-Id: I06602a29c95829b42add1d655ad8d7190ae7100a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105141
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-06-07 22:31:16 +00:00
Dan Rubel 9b22dd8e92 remove hard coded feature index
Change-Id: Ib01f2c9b1516987ec39591a5a320bab81138718d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104786
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-05 16:49:24 +00:00
Dan Rubel 9197b34a0e generate analyzer experimental flags
Change-Id: I7dc2be03e7266b6ef0a936269a2dbe584096e3db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104785
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-05 14:17:35 +00:00
Konstantin Shcheglov eff6e95385 Improve code generation for variant classes.
Change-Id: Iabaceebdf6efbec80d0026b74f71eac45b742760
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103600
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-05-24 21:55:16 +00:00