Commit Graph

6105 Commits

Author SHA1 Message Date
Brian Wilkerson fe580d63c4 Add support for a couple of data-driven fixes to the bulk fix processor
Change-Id: I202029bdb4a39ec3f604df5cd59f94fb22d2e488
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165081
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-29 19:43:48 +00:00
Danny Tuppeny 144a4545a0 [Analyzer] Update LSP toJson() functions to call toJson() on child fields
Change-Id: I596af3142ea3f1a279d3d98390cfe7e4d9d90cbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164962
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-29 17:42:47 +00:00
Danny Tuppeny 8b567447dc [Analyzer] Use new NAMED_REQUIRED ParameterKind for signature help
Change-Id: Ia4d23cb51f4e3729e8d40fa5a38dd8b2a8771c03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162006
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-29 07:38:14 +00:00
Brian Wilkerson 5a087b90ce Report another error in the data-driven data file
Change-Id: Ia252f69f70caeee6343978c7f8528b092e48c973
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164804
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-28 19:37:57 +00:00
Brian Wilkerson 9fc21c8414 Fix a bug in data-driven fixes template support
The parser was returning null where a null was not expected.

Change-Id: Ie0dd72a96d384cd62bc03d8af4fa6a3733980731
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164803
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-28 18:22:26 +00:00
pq f2dea6ca34 handle parts in the bulk fix loop
Fixes: https://github.com/dart-lang/sdk/issues/43564

Change-Id: I1b8f0859f5e13f2fbab1724a78bd243f755b4ccf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164680
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-25 23:52:34 +00:00
pq f0d1fe173c utility that reports bulk-fixable lints
Change-Id: Ia3946edc36955430c5141b004293093ab09c923d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164604
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-25 22:53:34 +00:00
pq d11734f5a0 bulk fix for prefer_inlined_adds
Change-Id: I0d165fcc2068ccb05b1ef202cae29c4e415a430a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164603
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-25 21:55:54 +00:00
Brian Wilkerson 434a4d4919 Offer diagnostics for new metadata file to LSP clients
We are in the process of adding a new YAML file for configuring the
fixes in the server, and server is producing diagnostics when the file
content isn't valid. This is an attempt to make those diagnostics
available for clients.

I wasn't sure where to add tests for this, so a pointer would be
appreciated.

Change-Id: Ibd60d70867c6f10835b6f9014006d50b91259549
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164460
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-25 18:05:24 +00:00
pq 2f5844a184 bulk fix for prefer_const_constructors
Change-Id: I54579790f7fd35cb79ac2f28609a620d1a4f9c2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164423
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-25 17:44:24 +00:00
Paul Berry def50905c2 Make flow analysis handling of is/==/??=/?. consistent with mixed mode semantics
Bug: https://github.com/dart-lang/language/issues/1143
Change-Id: Id177f8b19c15ef246f21ddd840410cddfee2e5cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163600
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-25 08:35:03 +00:00
pq ea20802e2e bulk fix for prefer_collection_literals
Change-Id: Idc83fdc00296388f9e7b0eb35ae4d195577906ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164401
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-09-24 21:13:37 +00:00
Danny Tuppeny 17d149074c [Analyzer] Fix incorrect indents in Flutter quick-fixes for code using \r\n
Change-Id: I7125c7aed5e069a1b941d15c5bd4bb97a671ea37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164325
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-09-24 17:12:00 +00:00
Konstantin Shcheglov d219bde703 Enforce await_only_futures and fix violations (in more packages).
Change-Id: I1812f7721915178e42956f988b9276bf8db0bfaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164281
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-09-24 16:58:50 +00:00
Konstantin Shcheglov 7ec28c3f08 Enforce await_only_futures and fix violations.
R=brianwilkerson@google.com

Change-Id: Icfc093d46562ddc7084151e76f495cc1462bb900
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164257
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-09-24 14:28:00 +00:00
Brian Wilkerson fdf4a1cc47 Fix the production of overrides under null safety
Bug: https://github.com/dart-lang/sdk/issues/43535
Change-Id: I9386d3abed83095e2363ba9b52c111dc93356914
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164260
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-23 22:42:59 +00:00
Devon Carew feb482abb5 [analyzer] remove unused command line options
Change-Id: I2bb415fefe7e1ebe95cea533f4979ca5f8cff4fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164180
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-23 19:21:59 +00:00
Brian Wilkerson 69de8fd3d4 Make it possible to write imported names in data-driven fixes
Change-Id: Icc1843a767261180df2b07205faf3f960adf0826
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164200
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-23 18:46:09 +00:00
Danny Tuppeny f7b1a1ee1f [Analyzer] Support excluding folders from analysis with LSP configuration
Change-Id: Idc0ac1107e0e82dab15533739712a20bb5f24efc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164094
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-09-23 15:01:09 +00:00
Danny Tuppeny 24eff206ee [Analyzer] Don't return LSP code fixes for files not being analyzed
Bug: https://github.com/dart-lang/sdk/issues/43521
Change-Id: I6853bec8d73997f3b830737010c31da69d826d3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164089
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-09-23 14:00:39 +00:00
Danny Tuppeny c2e8d1df06 [Analyzer] Return GET_FIXES_INVALID_FILE for getFixes requests for files outside roots
Bug: https://github.com/dart-lang/sdk/issues/43521
Change-Id: I250bca1131b3d8bc7f8232db82f7f03008b3db48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164088
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-09-23 14:00:32 +00:00
Danny Tuppeny 4c95e2cba8 [Analyzer] Update more correction tests to test with \r\n on Windows
Change-Id: Ie91cb32a238d20334fac094c93b4218d4cdb62ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163942
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-23 10:59:37 +00:00
Danny Tuppeny f820c1fb8e [Analyzer] Support using \r\n in correction tests when running on Windows
Change-Id: Id56e7c17974d5036706dbe451a2c307907bdcd3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163208
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-23 07:53:16 +00:00
Brian Wilkerson dc4458817e Fix an exception when computing fixes for a file outside the analysis roots
Bug: https://github.com/dart-lang/sdk/issues/43521
Change-Id: I562fcea7edea191448cbbf63faf9fe90fcc34b36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163881
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-22 16:11:23 +00:00
Brian Wilkerson 5a4402ac30 Add failing tests illustrating a bug
Change-Id: I38d665995b782c94805c5cb7dd5cfb08daf19e0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163726
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-21 21:57:12 +00:00
Brian Wilkerson a3e3328d95 Add support for validating code templates
This also includes some renaming that I missed in the previous CL when
ValueExtractor became ValueGenerator.

Change-Id: I289fbcf679eef2e3e3661167db533a2ba481176d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163725
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-21 21:38:12 +00:00
Brian Wilkerson 104f5496ca Initial support for referencing imported names in data-driven fixes
This doesn't yet update the imports when appropriate. To do that I think
I'm going to refactor the code so that code templates and value
generators have a `validate` and `apply` pair (though I might call
`apply` something like `generate`). Right now the code is generating
values during validation (to ensure that values _can_ be generated),
but we can't update the imports during validation.

Change-Id: I97b8cc4e9dfcea6611652f5a78ff664d3b93f761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163683
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-21 17:54:16 +00:00
Brian Wilkerson d6b30dcdda Finish supporting extends types for type parameters
Change-Id: I15cd911a24b57dc6a60f59c49f884840d5034403
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163601
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-21 15:21:56 +00:00
Brian Wilkerson a8586206f8 Implement code templates for data-driven fixes
Change-Id: Ic91c09d1f39212dfb4639c24e1dfcdc8de9271cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163560
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-19 23:34:37 +00:00
Konstantin Shcheglov fd0a7f92d5 Fix a hint in TokenDetailBuilder.
R=brianwilkerson@google.com

Change-Id: I0c005363ad0ad2a4d5d30647fcf76231120f729a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163402
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-09-18 18:34:06 +00:00
Mike Fairhurst cd7ca6b26f [analysis_server] Fix type nullability for "add try" fix
You can't throw null, so can't catch nullable types.

Ensure we don't print '*' in any case.

Handle nested types.

Change-Id: I69119bf6e7424d1a8771bd1f7d2fcc98b692cf9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163130
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-09-18 01:21:41 +00:00
Danny Tuppeny c0c5a7404c [Analyzer] Make newlines in fixes like CreateMissingOverrides consistent on Windows
See https://github.com/Dart-Code/Dart-Code/issues/2766.

Change-Id: Ib1d5f06a9a3667c704e9656b233cc2cce01fa3d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163206
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-17 16:01:10 +00:00
Mike Fairhurst 42f334fef5 [analysis_server] fix nullable types in closure params of default values
Change-Id: I58d4e2770089e551f431883b385d35314eac4592
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163001
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-09-16 23:17:49 +00:00
Mike Fairhurst 7da89dadaf [analysis_server] Add nullability assertions to token list API
Easy way to not have to support it today, but not have to worry about it
being buggy in the future.

Change-Id: I4f60bcf459c770614faf566b670744ab59c1a7ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163125
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-16 22:43:39 +00:00
Brian Wilkerson 71b3338d3c Rename value to argumentValue in add-type-argument change
Change-Id: I6b87da634457eee2d414aa97a298b3039bcf784c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163122
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-16 21:54:19 +00:00
Mike Fairhurst ad3deac7d9 [analysis_server] Show correct nullability for required parameters
Change-Id: I13f2f4693370e5e445bb3d2065a17b698be45e75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162862
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-16 21:44:29 +00:00
Mike Fairhurst e395675d0b [analysis_server] Show correct nullability for named parameters
Change-Id: Ia0aedc01493ef6a1bccbdbcfee5fd70ec3ef02db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162820
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-16 21:10:49 +00:00
Brian Wilkerson af69f8fa56 Add a quick fix that will make a variable nullable
Change-Id: Idca6d855c177a7076e55385b8526c0475eef2051
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163020
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-16 15:29:18 +00:00
Danny Tuppeny 5aa25f039c [Analyzer] Handle literal types in LSP spec correctly
This ensures canParse() methods correctly handle literal types from the LSP spec instead of allowing any literal of the same type to pass.

Change-Id: I4876f4adc8de1d9138e0f62868aa6a8a010b9102
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162753
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-09-16 15:22:58 +00:00
Brian Wilkerson 96d1b25486 Report errors in the data-driven fix data file
Change-Id: Iaaa29d339d4c007f93bcc924f62e0f36471fe10c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162945
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-15 22:55:31 +00:00
Brian Wilkerson 8f60cebd9c Prevent a cast exception in convert-to-if-null
I wasn't able to find a case that reproduced the exception. I suspect
that this means that we won't produce a fix in at least one case where
we could be. If you have ideas for how to reproduce, let me know.

Bug: 43432
Change-Id: Id1a2ffec281d6622792253358243c0fad4387f6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162922
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-15 20:47:11 +00:00
Danny Tuppeny 7b6c102137 [Analyzer] Encode/decode LSP payloads in tests to ensure they behave the same as real messages
Change-Id: Ia9efb2d5ba02fe60560b8deb663856ec27c79a87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162745
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-15 20:10:11 +00:00
Brian Wilkerson 4254663bad Sort transforms by date
Change-Id: I136f9f40d00901eed6572f31dfc195e17e71efaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162783
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-14 19:58:27 +00:00
Brian Wilkerson 1587b16a85 Add argument even when null is not a valid value
Based on Friday's conversation.

Change-Id: I6c741b0b46cff674006827c34e2b96ec1d9fa041
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162628
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-14 15:46:49 +00:00
pq e78a7cc4d7 bulk fix for diagnostic_describe_all_properties
Change-Id: I08996a8ff11a49ea2296baff62b823fd329eae31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-09-14 14:48:44 +00:00
Brian Wilkerson 5f7faba825 Encapsulate the element kind behind getters
As discussed in an earlier CL

Change-Id: If1dbd00a718cb4d5042707f2f0eba68e041a90d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162627
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-14 14:41:43 +00:00
Brian Wilkerson b3f1d1a207 Report missing keys in data files
In addition to adding reporting for missing keys this CL also contains
some general clean-up in the parser to make it easier to report errors.

Change-Id: Iba89a9855d506ae1fb4f91bf101212b4ab2442dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162626
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-14 14:40:40 +00:00
Konstantin Shcheglov ba78db411a Remove DartSdk.analysisContext
Change-Id: I6a67344d928e6182a851741bbbc862284af710c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162623
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-09-13 00:56:36 +00:00
Brian Wilkerson d2004e6811 Support renaming constructors from named to unnamed or vice versa
Change-Id: Id447d6b6d6bb75d88a68b1c9f3ca865290e5cf70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-12 23:18:56 +00:00
Konstantin Shcheglov c71ce5234d Remove DartSdk.analysisOptions getter/setter.
Change-Id: I6bdcd1d8c2e998bf4adbf26ddf533f5d649c73c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162620
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-09-12 21:33:26 +00:00