Commit Graph

7661 Commits

Author SHA1 Message Date
Danny Tuppeny 658e34ee2a [analysis_server] Fix ordering of parameter+type InlayHints at the same position
Parameter name hints should always come before any other hints at the same position:

```
f(a: <int>[]);
  ^  ^^^^^
```

Change-Id: I8ae06c562e80df441fee9d3a8079c0048d01f903
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284641
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-02-22 15:38:32 +00:00
Sam Rawlins 61e1808e2f [analyzer] Move 5 more HintCodes to be WarningCodes, SUBTYPE_*, UNDEFINED_*, UNNECESSARY_*
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: I7d15e27697093ecbdb958900f57e40d01753fdb3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284541
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-02-22 15:24:39 +00:00
pq b0078ad057 + RECORD_TYPE_ONE_POSITIONAL_NO_TRAILING_COMMA diagnostic
See: https://github.com/dart-lang/sdk/issues/51446

Change-Id: I4ebb0a8978bd98fc658737f69b790c2039c17d52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284501
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-02-22 02:07:53 +00:00
Keerti Parthasarathy b8db4a1272 Add a navigation test for patterns
Change-Id: I77094c1f58d7d3efa557607634acc393f0f6ff9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284381
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-02-21 23:59:02 +00:00
Kallen Tu 57107ae59b [analysis_server] Add code completion for class modifiers at the beginning of a declaration.
Change-Id: I9dc1d80264d052c8f2ac75978e64280bd271f8d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-21 19:31:55 +00:00
Danny Tuppeny bc91549aea [analysis_server] Use the more specific "refactor.move" for Move Class to File
VS Code refactors based on kind and shows some well-known kinds in a specific order. One new group is "refactor.move".

It's not yet in the LSP spec/code-gen, so is added to our custom enum in the meantime.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4354.

Change-Id: I5577ef67a81667652258b873125dc491d96ce597
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284144
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-02-21 17:27:27 +00:00
Danny Tuppeny e8a8e10bcd [analysis_server] Include Type inlay hints for inferred type arguments + literals
Fixes https://github.com/Dart-Code/Dart-Code/issues/4366.

Change-Id: I92b28869961a6098031a21ca1cf0d34f4decd16c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284143
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-02-21 17:07:25 +00:00
Konstantin Shcheglov a70386bfd6 Report CONSTANT_PATTERN_NEVER_MATCHES_VALUE_TYPE
Change-Id: I782bcf984e47162340baf96245dab8792fa3cbe0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284241
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-02-21 17:01:32 +00:00
Ilya Yanok 029e0cec71 Revert "Enforce current library restrictions."
This reverts commit 0c05e33836.

Reason for revert: breaks ~10% of G3 smoke suite.

Original change's description:
> Enforce current library restrictions.
>
> Mark all currently unimplementable types as `final`, or `sealed` for `num` and `final` for `Function`.
> Mark all current classes intended as mixins as `mixin class`.
>
> More additions and cleanup will follow,
> but this change should make everything keep working as today
> if we flip the switch.
>
> TEST= No new tests, very little actual change, covered by existing tests with few changes. Will add more tests when adding more modifiers.
>
> Change-Id: I40e724f823e7f88cdef186d2f73874df256e2f43
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281683
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Kallen Tu <kallentu@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ib0cb5b7ec1a8c392bbf9bf4af8dc3efc0b27991d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284187
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-02-20 15:29:41 +00:00
Brian Wilkerson 392c2d6413 Add more tests for pattern variables
Change-Id: I44cab7deebf8e3be15890427055e833c00c5d322
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283963
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-02-20 01:23:28 +00:00
Lasse R.H. Nielsen 0c05e33836 Enforce current library restrictions.
Mark all currently unimplementable types as `final`, or `sealed` for `num` and `final` for `Function`.
Mark all current classes intended as mixins as `mixin class`.

More additions and cleanup will follow,
but this change should make everything keep working as today
if we flip the switch.

TEST= No new tests, very little actual change, covered by existing tests with few changes. Will add more tests when adding more modifiers.

Change-Id: I40e724f823e7f88cdef186d2f73874df256e2f43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281683
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
2023-02-18 12:37:40 +00:00
Konstantin Shcheglov 3f288db57e Issue 51046. Implement primitive equality.
Bug: https://github.com/dart-lang/sdk/issues/51046
Change-Id: I2190b9e36753cc5f4708597ae0b515430d2f7bf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-02-18 06:22:04 +00:00
Jackson Gardner d90a06bf89 Revert "[analyzer] Move 6 more HintCodes to be WarningCodes, STRICT_*, SUBTYPE_*, UNDEFINED_*, UNNECESSARY_*"
This reverts commit 86278e3c2e.

Reason for revert: This is breaking flutter customer tests. See https://github.com/flutter/flutter/issues/120992

Original change's description:
> [analyzer] Move 6 more HintCodes to be WarningCodes, STRICT_*, SUBTYPE_*, UNDEFINED_*, UNNECESSARY_*
>
> Bug: https://github.com/dart-lang/sdk/issues/50796
> Change-Id: Ic65b01d19984874c442722de472b21701f85ee5d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283400
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: Ia2eaba6ebbbad13fe31b783b39c02b1adce322b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283923
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
2023-02-17 19:37:29 +00:00
Brian Wilkerson 3512e6e636 Produce suggestions for pattern variables
Change-Id: Icbef58507a63bde636dc70a981cd6e2083990a29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283743
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-02-17 18:51:11 +00:00
Sam Rawlins 59d7ca176f [analyzer] Move 7 more HintCodes to be WarningCodes, INVALID_*
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: I7ce6ec4562352d5ed7d6f4b3d6de3316ed9271e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283701
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-02-17 14:51:17 +00:00
Devon Carew 39603fd3d0 [dart fix] remove a check that a lint code was enabled when performing a bulk fix
Bug: https://github.com/dart-lang/sdk/issues/51427
Change-Id: I67ae94d626d16ac831996b1ce4da626afcfccd56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283462
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-02-17 00:58:41 +00:00
Kallen Tu 3118002665 Revert "[analyzer/cfe] Report an error when declaring a mixin class with final, interface, or sealed."
This reverts commit f17e9732c5.

Reason for revert: Merged this and forgot there were dependencies that needed to be merged first.

Original change's description:
> [analyzer/cfe] Report an error when declaring a mixin class with final, interface, or sealed.
>
> Change-Id: Ia1393851dffaab55c31d04d4e81bfae83a7bd67f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283126
> Commit-Queue: Kallen Tu <kallentu@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

TBR=scheglov@google.com,johnniwinther@google.com,kallentu@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Ia339aac26ecd20aa8725cc9109919e3cbef6363b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283741
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-02-16 22:10:33 +00:00
Kallen Tu f17e9732c5 [analyzer/cfe] Report an error when declaring a mixin class with final, interface, or sealed.
Change-Id: Ia1393851dffaab55c31d04d4e81bfae83a7bd67f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283126
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-16 21:27:28 +00:00
Keerti Parthasarathy 71bbeddf00 Add quick fix for invalid_constant_pattern_binary and invalid_constant_pattern_negation diagnostic.
Bug: 49960
Change-Id: Ib6c6951da8febd5bbe53b704d34530da0e47a0e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283461
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-02-16 20:22:54 +00:00
Danny Tuppeny ba3171ae3e [analysis_server] Include types in tooltips for record fields in patterns
Change-Id: I768fe2b44a25b43c36c65414807b2201ebe97665
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-02-16 15:16:31 +00:00
Sam Rawlins 86278e3c2e [analyzer] Move 6 more HintCodes to be WarningCodes, STRICT_*, SUBTYPE_*, UNDEFINED_*, UNNECESSARY_*
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: Ic65b01d19984874c442722de472b21701f85ee5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283400
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-02-16 14:47:49 +00:00
Keerti Parthasarathy 962d4342a7 Wire up two more pattern diagnostics for fixes
Change-Id: I298fb7295d3f9ff97a9d6f28abd93bbdda6692aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283344
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-02-15 22:46:57 +00:00
Brian Wilkerson ea3b2e3038 Support code completion in several new places
Change-Id: Ic663a7ba2b9d8995f601320df4d3254ae4917094
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283341
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-02-15 19:23:37 +00:00
Johnni Winther 0937087af8 [parser] Improve error recovery for constant patterns
This allows the parser to parse constant patterns at lower precedence
level in order to recognize more expressions in this context. To
support this, _parsePrecedenceExpressionLoop special cases a few cases
that should _not_ be parsed as expression in a constant pattern context.

Closes #50996

Change-Id: I43bb0ce52d366bd2dfcf47e12eec5883402f668a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282100
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-02-15 13:49:37 +00:00
Johnni Winther d4a73e3b82 [cfe] Report errors on invalid const patterns with explicit 'const'.
Change-Id: I4f5994fd1f0d5e5289684e0da2f03720706f6d28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-02-15 10:34:28 +00:00
Brian Wilkerson 6189798117 Support completions of and in when clauses
Change-Id: Ia02aebfe1dd90d46ae4207e38f8391b4e33f2ee9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283241
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-02-15 04:47:41 +00:00
Konstantin Shcheglov 59d080301e Index, search, rename for pattern fields.
Change-Id: Iaeae578d18c139850664f30fc5bbc92ad95132ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283127
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-02-15 03:54:58 +00:00
Sam Rawlins 306029141a [analyzer] Move 4 more HintCodes to be WarningCodes, Must* and CAST_FROM_NULL*
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: I92df471f4882d2524b825df1bf096c5ff1131bdc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-02-14 23:38:30 +00:00
Ahmed Ashour 58f1534947 [analysis_server] offer fix for UNNECESSARY_SET_LITERAL
Fixes #51378

Change-Id: Ide2480f6d41ee628d7d0981083123a4a691324da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282601
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-02-14 15:37:23 +00:00
Danny Tuppeny cffd8a7ac1 [analysis_server] Add a snippet for switch expressions
Change-Id: I40f997a4bbb056162f91a5e7ed88332939eae908
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282721
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-02-14 15:36:28 +00:00
Sam Rawlins 4b913b1797 [analyzer] Move 4 more Hints to be Warnings, TEXT_* and TYPE_*
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: I05e7d6def39cb8c0a18f4d5685f679477d8af044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282803
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-02-14 15:22:28 +00:00
Konstantin Shcheglov 6a6b54c7d3 Report unnecessaryWildcardPattern()
Change-Id: I6bca9eb8ec95796bdbcb02a017e919c424d8415d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282482
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-02-14 01:07:33 +00:00
Sam Rawlins bf6576470d [analyzer] Remove HintCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT
We may move this to be a Lint (https://github.com/dart-lang/linter/issues/3939)
but for now there is no loss, as we never generate this diagnostic.

Bug: https://github.com/dart-lang/sdk/issues/50796 and
Change-Id: I4877884288a64722da4b5147f51cc3ecf934a76b
https://github.com/dart-lang/sdk/issues/48042
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282801
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-02-13 22:42:27 +00:00
Brian Wilkerson 5240b96b62 Support completion in for loops with patterns
Change-Id: I9d5c57e4e9c42abfbdc2a7dd85fc998826fa8342
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282390
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-02-13 20:55:14 +00:00
Brian Wilkerson 77174eff4a Support completion in switch expressions
Change-Id: I21df4780eed21043b3d97ea0e55c50285e4c9b28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282700
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-02-13 18:17:58 +00:00
Sam Rawlins 42402bf433 [analyzer] Move 6 more Hints to be Warnings, MISSING_*
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: Ie021ab23c4954c99ccb3f697302cada07b11cbf0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282164
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-02-13 16:32:26 +00:00
Ahmed Ashour 50063e66a8 [analysi_server] AddExplicitCast to handle
Set to List and vice versa.

Fixes: #49896
Change-Id: I15bce862d30c656b216fccb27e716083534ea2a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281380
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-02-11 21:11:49 +00:00
Ahmed Ashour b33058488c [analyzer] UNNECESSARY_NULL_COMPARISON
to handle implicitly null assigned variables.

Fixes #51093

Change-Id: Iab04292656f16a1085d39bdcd9efa27b55a2ecbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279709
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-02-11 16:09:39 +00:00
Konstantin Shcheglov c6352b0e49 Unit tests for NON_EXHAUSTIVE_SWITCH and UNREACHABLE_SWITCH_CASE.
Change-Id: I0b291046eba881acd35aeba1f4725c84f0bc9bcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-02-10 21:50:27 +00:00
Konstantin Shcheglov a22fd3abfc Add a little more details for completion using OperationPerformanceImpl.
Specifically, we:

1. Extract separate 'body' operation in '_resolveForCompletion', so
  that we separate the timing of this method execution vs the timing
  how long it took to strat running this body.

2. Add `OperationPerformanceImpl performance` to `computeSuggestions`.

3. Remove 'DartCompletionManager-' prefix from completion operations.

Change-Id: I01986e06cb51167b7d5702a10f7512e04305298c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282387
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-02-10 19:35:49 +00:00
Brian Wilkerson 243d7e5c39 Support completion in a relational pattern
Change-Id: Id31a1e27f70259383ba02f0de5e0c499fb9680cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282384
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-02-10 18:32:58 +00:00
Brian Wilkerson d4a9f2b32e Additional completions in switch pattern case
Change-Id: I25aa3ab3d6b8ce9974c40d6b7e776112599e4395
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282163
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-02-10 15:26:17 +00:00
Sam Rawlins bb9371f255 [analyzer] Tidy up much benchmark and integration test code:
* Add a type argument to raw `Future` types (typically `Future<void>`)
* Add type arguments to raw `Map` types (typically Map<String, Object?>`)
* Add a type argument to raw `Completer` constructor calls.
* Use collection-elements in more places.
* Replace an implementation of `String.padLeft` and `String.padRight` with
  StringBuffer extension methods that use `String.padLeft` and
  `String.padRight`.
* Rename many `sb` variables to `buffer`, which is more idiomatic.
* Move some StringBuffer helper methods to be extensions on StringBuffer.
* Use constructor tear-offs instead of closures which call a constructor.
* Use single quotes where we can.
* Do not prefix constant names with the letter 'k' [1].
* In IntegrationTestMixin:
  * Rename to `IntegrationTest`, as it is never used as a mixin.
  * Public Stream fields are converted to be getters.
  * Private StreamController fields are initialized at their declaration [2],
    instead of an initialization method.
* Remove empty zero-parameter constructors.

[1] https://dart.dev/guides/language/effective-dart/style#dont-use-prefix-letters
[2] https://dart.dev/guides/language/effective-dart/usage#do-initialize-fields-at-their-declaration-when-possible

Change-Id: I7a923a80d32f74fbecf42a0fa35ae25285994097
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281874
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-02-09 22:41:19 +00:00
Ahmed Ashour adb321a4b8 [analysis_server] add a fix for use_decorated_box
Fixes #50817

Change-Id: I78309df7cda2dc74b62eab3bdb48e52a3df02f94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280165
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-02-09 22:12:11 +00:00
Keerti Parthasarathy 93ecc28e01 Add call hierarchy tests for patterns
Change-Id: I450fbd6b92b6c4aa27d5e97a65be8f0520427ca7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-02-09 21:46:39 +00:00
Brian Wilkerson 6359791add Support completion in variable declaration lists in for loops
Change-Id: I21f2a197036365091c67be5c4952d4bf365afe27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281949
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-02-09 21:35:08 +00:00
Ahmed Ashour 65c692dec2 [analysis_server] fix ConvertToGenericFunctionSyntax
with type parameters

Fixes #51312

Change-Id: Ia09abe2d923783f4c88c1d85845d29c674ebc65c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281700
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-02-09 21:30:18 +00:00
Konstantin Shcheglov b63c0c545a Add missing features to PubPackageAnalysisServerTest.experiments, remove duplicates.
Change-Id: Icc48a13123177406e5fbc7793c9d03228edad5c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281948
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-02-09 21:07:53 +00:00
Sam Rawlins 467605592e [analyzer] Move 5 more Hints to be Warnings, INVALID_USE_*
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: Ifd52af7553f4a90a536cafb79584ffc0fa623407
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281741
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-02-09 21:01:41 +00:00
Brian Wilkerson 2a13798377 Handle pattern for loops in surround with assist
Fixes 51332

Change-Id: Ic0c6be09aff6313633192d90a10282774169a2a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281947
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-02-09 20:19:55 +00:00