Commit Graph

8258 Commits

Author SHA1 Message Date
Sam Rawlins d2a47e9cce analyzer: Add YouTube doc directive support
Work towards https://github.com/dart-lang/sdk/issues/52705

Change-Id: I4887304a4029c0279ae67bd45e8ef391a3eae56e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-09-06 15:45:48 +00:00
Sam Rawlins 4bddf8a25f Revert "Revert "linter: Refactor prefer_collection_literals to use context type more""
This reverts commit cbdae14d2f.

In addition, Fix prefer_collection_literals for methods with expression bodies

Original description:

linter: Refactor prefer_collection_literals to use context type more

There is a basic premise in this rule which we cannot satisfy exactly:
we need to disallow `LinkedHashSet()` unless the context type requires
the developer to use `LinkedHashSet`. But the context type is long
gone when the lint rule is run.

This CL adds some logic to try to attempt figuring out the context
type in the cases where users have filed bugs, but it will never be
super accurate.

Fixes https://github.com/dart-lang/linter/issues/4736
Fixes https://github.com/dart-lang/linter/issues/3057
Fixes https://github.com/dart-lang/linter/issues/1649
Fixes https://github.com/dart-lang/linter/issues/2795

Change-Id: I958ba69a56866c18523ce6cbf62645ef8e028f6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324260
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-09-05 23:49:49 +00:00
Keerti Parthasarathy 8b601a1cd2 Add support for extension types to document symbols.
Change-Id: Ie7fd8fc4812a84e1fbbc9760fb2f4e40c514c29c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324265
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-09-05 20:07:20 +00:00
pq ee2bc9d870 highlight the late token in unnecessary_late reports
Fixes: https://github.com/dart-lang/linter/issues/4742

Change-Id: Ia13a325dc44a49f5aab3d564f3adc0c10e80c4f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-09-05 18:49:26 +00:00
Danny Tuppeny cf5336c244 [analysis_server] Support extension types in Call Hierarchy
Change-Id: Ibc7a2df9135da1169e45b5eca4861a213eeea4f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324201
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-05 15:46:07 +00:00
Danny Tuppeny 82bd6a2e43 [analysis_server] Include extension types in LSP Type Hierarchy
Change-Id: If7a708d1a6f1b4133528fca6786375fffb2560e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324200
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-05 15:41:48 +00:00
Danny Tuppeny 144ea5b206 [analysis_server] Fix snippet context for initializing formals
Fixes https://github.com/dart-lang/sdk/issues/53308

Change-Id: I5b7f409882f00f347f014142c40be27ee81fed8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324100
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-04 17:28:47 +00:00
Ilya Yanok cbdae14d2f Revert "linter: Refactor prefer_collection_literals to use context type more"
This reverts commit cd8a3370e7.

Reason for revert: lint starts barking at the wrong tree: b/298917960

Original change's description:
> linter: Refactor prefer_collection_literals to use context type more
>
> There is a basic premise in this rule which we cannot satisfy exactly:
> we need to disallow `LinkedHashSet()` unless the context type requires
> the developer to use `LinkedHashSet`. But the context type is long
> gone when the lint rule is run.
>
> This CL adds some logic to try to attempt figuring out the context
> type in the cases where users have filed bugs, but it will never be
> super accurate.
>
> Fixes https://github.com/dart-lang/linter/issues/4736
> Fixes https://github.com/dart-lang/linter/issues/3057
> Fixes https://github.com/dart-lang/linter/issues/1649
> Fixes https://github.com/dart-lang/linter/issues/2795
>
> Change-Id: I3e6c6de81084dca2825488c89830ab3e7ea63186
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323680
> Reviewed-by: Phil Quitslund <pquitslund@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>

Change-Id: I980053dd51ffd4447721e0ad7436b07ca704b554
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324021
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2023-09-04 10:43:54 +00:00
Johnni Winther e3621561aa [parser] Refactor BlockKind
Refactors BlockKind to pass an explicit template/message instead
of injecting words directly into the message which leads to
grammatically incorrect english in the output message.

Change-Id: I3b91abf2e5a748f3dfca2cc0a6c877e77b3ad7d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322121
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-09-04 09:40:21 +00:00
Konstantin Shcheglov a7bb403125 Extension type. Test for DartSelectionRangeComputer.
Change-Id: I5e88681dc901a900e5de7ccd13e0c05341c42456
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323963
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-09-01 21:48:09 +00:00
Konstantin Shcheglov 53cd950e7a Extension type. Code folding.
Change-Id: I33ee2cf63a275c7c2d8f41c4033a0ee4d2641e28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323944
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-01 20:47:23 +00:00
Konstantin Shcheglov 49f5312fed Extension type. Overrides notification.
Change-Id: I1865e0d44093c1501b422d1b6d34fbc1e9612db8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323943
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-01 20:44:38 +00:00
Konstantin Shcheglov a0d32a1e3f Extension type. Include into 'occurrences' notification.
Change-Id: Ibfe62a4916c9b991e5d407e239d82ad8eb90b5ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323923
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-09-01 20:07:35 +00:00
Sam Rawlins cd8a3370e7 linter: Refactor prefer_collection_literals to use context type more
There is a basic premise in this rule which we cannot satisfy exactly:
we need to disallow `LinkedHashSet()` unless the context type requires
the developer to use `LinkedHashSet`. But the context type is long
gone when the lint rule is run.

This CL adds some logic to try to attempt figuring out the context
type in the cases where users have filed bugs, but it will never be
super accurate.

Fixes https://github.com/dart-lang/linter/issues/4736
Fixes https://github.com/dart-lang/linter/issues/3057
Fixes https://github.com/dart-lang/linter/issues/1649
Fixes https://github.com/dart-lang/linter/issues/2795

Change-Id: I3e6c6de81084dca2825488c89830ab3e7ea63186
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323680
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-09-01 19:58:29 +00:00
Konstantin Shcheglov 13e109e6b6 Extension type. Workspace symbols.
Change-Id: Ied0e652a18f07ab3b3e7d2a0d76bf20bf3dc55d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323921
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-09-01 19:15:48 +00:00
Konstantin Shcheglov 3e4ab6bc16 Extension type. Implemented markers.
Change-Id: I9477ac521f8889a935fe8b439b92f9cb65acad69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323920
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-01 18:56:57 +00:00
Konstantin Shcheglov 12bd986c71 Extension type. Request based test for rename, a fix for representation field.
Change-Id: Ic10550089272797724a0047a31fa040f4a293001
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323706
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-01 17:53:57 +00:00
pq 349e6266ff verify linter source sorting
Fixes: https://github.com/dart-lang/linter/issues/2368

Change-Id: I498e271dc32348115a34472b44688be8de2169a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-09-01 17:40:07 +00:00
Konstantin Shcheglov 84f65be285 Fix 'Extract Method' refactoring inside extensions.
Change-Id: If055456980361c5ec768bf5cb104af11cfa1b12e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323704
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-09-01 17:06:39 +00:00
Danny Tuppeny ddfc758572 [analysis_server] Expand list of features to review for new language features
I'm not certain all of these could be affected by new language features, but
it seems better to include them and do nothing than potentially miss something.

Change-Id: I4fc74e91511039b6679bc7b72dc3d90a1a45fc30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323661
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-01 15:06:49 +00:00
Konstantin Shcheglov 80a76ff357 Extension type. Extract method refactoring.
Change-Id: I34e08182b568bfc0296b45851ccedb803595efa8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323701
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-31 21:35:39 +00:00
Konstantin Shcheglov 55634cbb5b Extension type. Rename refactorings.
Change-Id: Ia65a8e18ff0a92b799ac376872b621e69ad61701
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323683
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-31 20:40:00 +00:00
Konstantin Shcheglov 2c9089f120 Extension type. More tests for search, highlight, navigation.
Change-Id: Iffa7e73be52219591dc75f8aacb7defa4b001b1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-31 19:36:37 +00:00
Konstantin Shcheglov 224a5c7d32 Enable language 3.2 for analysis_server/ and linter/.
Change-Id: Ifba960f2947a6c900c81fc794bfc5ed288cc2e97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323700
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-31 17:38:39 +00:00
Konstantin Shcheglov 702cca5a18 Extension type. Updates and tests for search.
Change-Id: I17c5c9eb5237ba6f090cab974d4419e46b584ac8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323504
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-31 16:02:18 +00:00
Sam Rawlins 734e9c3c5b analyzer: Report configurations in doc imports
Work towards https://github.com/dart-lang/sdk/issues/50702

Change-Id: If9c3d702f16e609e0d1f2c2bf09ec02a73cd5a54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323427
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-30 21:26:28 +00:00
Konstantin Shcheglov bbc3dcbe30 Extension type. Tests for type hierarchy.
Change-Id: Ic0e31bb13efd68a3413429d1ff9110bb9b268e2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323432
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-30 21:18:25 +00:00
Danny Tuppeny 5926a7301b [analysis_server] Fix duplicate fields when extracting widgets
Fixes https://github.com/dart-lang/sdk/issues/53383

Change-Id: Ia985f1c71c99416906bac4669ff61961d32f29fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-30 21:10:49 +00:00
Danny Tuppeny 4be9016afe [analysis_server] Migrate completion tests to use TestCode
No functional changes, just switching from `withoutMarkers()` and `positionFromMarker()` to use `TestCode` while I was in these files.

There are now approx 130 calls to `withoutMarkers()` remaining.

Change-Id: I71e7fa918d2ef00e7ad64820392920a1f28a7222
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323480
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-30 21:10:22 +00:00
Konstantin Shcheglov f722afcf0c Extension types. Support for sorting.
Change-Id: I632b05f9e02283eca663e68d6087230182003e97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323425
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-30 18:55:31 +00:00
Danny Tuppeny eb73dba14d [analysis_server] Add support for additional completion label details
This allows more of the signature and URI to be shown in the full completion list without needing to cursor through each item to see it.

Some examples can be seen in https://github.com/Dart-Code/Dart-Code/issues/2462#issuecomment-1663786808

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

Change-Id: Ib8290f90c31f974271109df7912d230b5e824319
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-30 15:51:03 +00:00
Sam Rawlins 1288b96e52 Parsing support for doc imports
Work towards https://github.com/dart-lang/sdk/issues/50702

* This adds a `docImport` field to the `Comment` class.
* Doc imports are parsed with the standard Fasta parser and
  AstBuilder.
* We add one static check that `deferred` isn't used. Other
  checks are needed.
* Many tests.
* We need to add support for line splits in a doc comment.
* I think doc comment imports need to be visted by AST visitors,
  but maybe I am wrong...

Change-Id: I06e2b6fe42ef5ce916d46d9a9db35334726677d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322591
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-30 15:35:18 +00:00
Kallen Tu af24f1d61a [analyzer] Report more specific diagnostic codes instead of INVALID_CONSTANT.
Add a more specific, but for general use, diagnostic for when the evaluator encounters a type parameter. The errors should match more closely to the CFE errors now.

This CL also tidies up some other areas like `_evaluatePropertyAccess` and produces a better error than `INVALID_CONSTANT` when you try to access something that's not String.length.

Change-Id: I4780e6e52049887a0ee44cdf046968f332527079
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322364
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-29 22:36:02 +00:00
Keerti Parthasarathy 49d159da36 Add a file name parameter to sort imports function
Change-Id: Ie41c7f28f90a74449dfb26e78a1c417d6fd82440
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323204
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-08-29 20:04:17 +00:00
Kallen Tu 1c67426891 [analyzer] Report cycles in constant constructors.
Cycles were not previously reported because constructors don't have an
evaluation result (since it depends on the invocation arguments).

This CL uses the ConstantVerifier to check every constant constructor.

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

Bug: https://github.com/dart-lang/sdk/issues/46735
Change-Id: Ie8419787b621abb303ecc738aa36f2e7abf96a38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317841
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-29 19:02:38 +00:00
pq 813339e28a refactor TargetKind enum to class
A trimmed down version of https://dart-review.git.corp.google.com/c/sdk/+/258200 which was reverted (https://dart-review.git.corp.google.com/c/sdk/+/268380) for (undiagnosed) performance reasons.

See: https://github.com/dart-lang/sdk/issues/53368


Change-Id: Iecd00a4483a4b6904b8b281eec49228620e1e943
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322981
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-28 23:09:27 +00:00
Devon Carew 97168c581a [deps] rev http, markdown, mockito, tools
Revisions updated by `dart tools/rev_sdk_deps.dart`.

http (https://github.com/dart-lang/http/compare/631d4ec..cad7d60):
  cad7d60  2023-08-26  Alex James  Add response status code test (#1009)
  5ac7cfe  2023-08-24  Alex James  JavaClient stream response body using byte arrays (#1007)
  0e6e58a  2023-08-23  Brian Quinlan  Don't check the formatting of `ffigen`ed code (#1010)

markdown (https://github.com/dart-lang/markdown/compare/faabb1a..56e75df):
  56e75df  2023-08-26  Parker Lougheed  Standardize CommonMark spec links to https and v0.30 (#553)

mockito (https://github.com/dart-lang/mockito/compare/70aabfc..f5abf11):
  f5abf11  2023-08-28  Nate Bosch  Add a best practice sentence about data models

tools (https://github.com/dart-lang/tools/compare/e5ce42a..b72fae8):
  b72fae8  2023-08-24  Danny Tuppeny  Export Survey in package:unified_analytics (#151)

Change-Id: Id09f2300d3132a101dfaf84d9dc475ba92590aeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322980
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-08-28 20:10:16 +00:00
Konstantin Shcheglov 83fc715bef Extension type. Report EXTENSION_TYPE_WITH_ABSTRACT_MEMBER.
https://github.com/dart-lang/language/commit/913b81ed505cbe2cd21bb77b108293314d298184

Change-Id: Ic3303744ea4c1f2cc90df63a3ae52b51861757ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322983
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-28 18:55:00 +00:00
William Hesse ccc7ebcfd9 [linter] Remove linter from DEPS
The linter package is now in pkg/linter, not checked out into
third_party.

Bug: https://github.com/dart-lang/linter/issues/4411
Change-Id: Ia7cc11b1d2db05dcc38d40b895ac20845f6116e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322920
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2023-08-28 16:01:13 +00:00
Danny Tuppeny 9004168e1a [analysis_server] Fix filterText for overrides
I noticed filterText was incorrect in some cases - for example if label was "MyClass(a)" filterText should be only "MyClass" without the "a".

There was a test for this but it was wrong, it checked filterText was null, even though label contained parens (a null filterText means use label).

I renamed the tests so they moved around a little, but they should be clearer (and more correct) now.

Change-Id: If94f80e8d7dc8b394c49eebb4d7482de2d62c38b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322461
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-24 19:09:35 +00:00
Danny Tuppeny b5ed2bb7c0 [analysis_server] Add support for survey prompts
Change-Id: I0447de090311694712fce005806c6ac296ca2eac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322406
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-24 16:36:02 +00:00
Johnni Winther b1594fa130 [parser] Handle invalid extension type header in error recovery
This expands the existing recovery for class headers to handle
invalid, out-of-order, and duplicate clauses in extension type
declaration headers.

Change-Id: I7b33b91cc718e4c0673137121b8d083fa0ef1562
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321900
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-08-24 11:20:18 +00:00
Keerti Parthasarathy 35149e979e Add a test case for #52902
Change-Id: I2402e14901c572bc8bb458ef261b7a38527b6043
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322447
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-23 23:22:02 +00:00
Danny Tuppeny 7e68622678 [analysis_server] Extract a UserPromptSender to simplify sending prompts to the user
This mirrors a similar change made for OpenUriNotificationSender to avoid callers having to check the `supportsShowMessageRequest` flag before calling `showUserPrompt`. Instead, they can ask for a sender and get a `null` if it's not supported.

Also removed a `!` in initialization options that was a bit dangerous (I triggered errors while testing surveys) and instead made all code that reads initialization options handle the case where initialization hasn't happened with a safe default where appropriate.

This should not change any functionality, it just makes an upcoming CL (with functional changes) smaller/simpler.

Change-Id: I730b7879b5f49a3b6c99414b054724e2c0ca6515
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322402
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-23 16:39:33 +00:00
Johnni Winther 7e9c1c8018 [parser] Add error recovery to extension type declaration parsing
This changes the parser to always interpret `extension type` as the
start of an extension type declaration.

Recovery is added to handle missing identifier, primary constructor,
parameter constructor parameters, and extension type declaration body.

Change-Id: I98cac0b2641167c4708fa20b22f0de0a70336457
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321704
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-08-22 12:05:10 +00:00
Danny Tuppeny cd4b9527eb [analysis_server] Fix "dart fix" not handling directives_ordering
Fixes https://github.com/dart-lang/sdk/issues/53261

Change-Id: I5b7f87efeee1046959b81f0a07f07ce1f81706d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-21 16:44:11 +00:00
Keerti Parthasarathy 36a146f037 Add utility methods for format and sort imports
Change-Id: I6f0408d8da8592ad125bcb4b9c4ff90fc3a9540c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321541
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-08-18 14:55:59 +00:00
Helin Shiah 6b03758f76 Collect analytics from VS Code remote usages
This is the ID sometimes sent for internal VS Code users, and we want to capture these users as well for some internal IDE tracking.

Change-Id: Id3b5aa89eacefb873e88b59745014454a89e6a73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321323
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2023-08-17 20:24:30 +00:00
Kallen Tu 48245c1064 [analyzer] Issue 53163: Fix crash with unresolved object in String length for const expressions.
Unresolved types would throw in `stringLength` and we don't handle them the same way we do with the other operators. Throwing EvaluationExceptions is the problem here, but that's for another CL.

In the meantime, this CL makes `stringLength` consistent to the other operators in the DartObjectComputer.

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

Bug: https://github.com/dart-lang/sdk/issues/53163
Change-Id: Ib99b61736d699056fa3c379e4d9c79756a4425f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319562
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-08-17 19:48:28 +00:00
pq edaea9b489 quick fix for REDECLARE_ON_NON_REDECLARING_MEMBER
See: https://github.com/dart-lang/sdk/issues/53121

Change-Id: I324f8a14820da2e9e5b714f9f1d88c647f9cfebc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321424
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-08-17 17:28:59 +00:00