Commit Graph

7869 Commits

Author SHA1 Message Date
Kallen Tu ad7f7860d9 [analysis_server] Dot shorthands: Update CreateGetter and CreateField.
`CreateGetter` and `CreateField` are now two available fixes for dot shorthand property accesses.
Updated each fix to handle dot shorthands using the computed context type element and added tests.

Bug: https://github.com/dart-lang/sdk/issues/60994
Change-Id: I6b21c8034521503eae6c490597a1b3894acb489c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442247
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-07-29 11:09:26 -07:00
Chris Sauer 590d6f292b Fix typo: checkVisibilty -> checkVisibility
Closes https://github.com/dart-lang/sdk/pull/61207

GitOrigin-RevId: b5ad0f59552e7d8b5347844c42e0547855521eff
Change-Id: Ic17a75877949d06fffff5f5c38c893944e3b2fee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442564
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-07-29 07:43:10 -07:00
Fedor Shcheglov 0bc13a8e00 Change rename class member refactoring to allow renaming chained super formal parameters, and renaming field formal parameters to private.
Bug: https://github.com/dart-lang/sdk/issues/60803

Change-Id: I6eab2eaa6d724f7f2c544c6f2bf74e9e73ad31f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442249
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-28 10:25:19 -07:00
Fedor Shcheglov a35946cdc6 Rename parameters and _parameters in element.dart to formalParameters
Change-Id: I62ec961129ca0191f7cb228ef94915d2627c3209
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442172
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-07-28 10:20:49 -07:00
Sam Rawlins 38b60624d4 DAS plugins: Test how an unsupported request is handled.
Change-Id: If214c32f396867a5af0a3bfcc40946121c895aef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442285
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-07-28 09:44:52 -07:00
Konstantin Shcheglov a278738f3c Elements. Make PropertyAccessorElement.variable non-nullable.
The null assert in `PropertyAccessorElementImpl.variable` is safe
because `ElementBuilder` always creates synthetic
`TopLevelVariableFragmentImpl` or `FieldElementImpl` for a getter or
setter. And the other way around, non-synthetic
`TopLevelVariableFragmentImpl` or `FieldElementImpl` when created
associate itself with synthetic getter / setter.

Change-Id: I40e4ce866edffab6c8bcdf6e408bd1bbfbba6581
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442246
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-25 15:45:02 -07:00
Kallen Tu c42bdd1be2 [analysis_server] Dot shorthands: Update ChangeTo fix.
Updates the `ChangeTo` fix to handle miswritten dot shorthands.
We use the calculated context type to determine the closest element that
the user might be attempting to write.

Bug: https://github.com/dart-lang/sdk/issues/60994
Change-Id: If69b6b30fa70a9cd047a3f2946ae1e0883f322e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442168
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-07-25 12:40:51 -07:00
Danny Tuppeny 684a39190b [analysis_server] Fix completion error when a typedef points to a mixin
This fixes an exception that prevents completion from working if a typedef points at a mixin, which is something Flutter has:

```dart
typedef RenderConstrainedLayoutBuilder<LayoutInfoType, ChildType extends RenderObject> =
    RenderAbstractLayoutBuilderMixin<LayoutInfoType, ChildType>;

mixin RenderAbstractLayoutBuilderMixin<LayoutInfoType, ChildType extends RenderObject>
    on RenderObjectWithChildMixin<ChildType>, RenderObjectWithLayoutCallbackMixin
```

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

Change-Id: Ibf31612d34893f2183a7da513359bdbff6a5c066
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441962
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-07-25 09:31:40 -07:00
Fedor Shcheglov 4bb2269a06 Fix renaming super formal parameters in long subclass chains.
Bug: https://github.com/dart-lang/sdk/issues/61194

Change-Id: Icb3b8e5044e13e046122490e1dfceb5dc944eafe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442170
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-24 21:54:16 -07:00
Elliott Brooks a1699ecfb0 [Property Editor] Use dot-shorthand syntax in enum edits when possible
Bug: https://github.com/dart-lang/sdk/issues/60727
Change-Id: I41388422b0c317e7500166d29ba4f9e7b656a24f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441862
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
2025-07-24 13:40:35 -07:00
Kallen Tu 289278b584 [analysis_server] Dot shorthands: Update ReplaceFinalWithConst fix.
Adds an extra dot shorthand constructor invocation case to the
`ReplaceFinalWithConst` fix. Added relevant tests.

Bug: https://github.com/dart-lang/sdk/issues/60994
Change-Id: I23d9882ae5b8633a29f6d50a40de35d80edb2a2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-07-24 13:35:09 -07:00
Brian Wilkerson 3303e1d140 Convert the summary request to use the elememnt model
Converting the summary request to use elements allows us to include API
from parts as well as API exported from other libraries in a uniform way.

Change-Id: Iad4982efc76c41331e0507bd6fc95e8ee0e4c9c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441833
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2025-07-24 13:00:29 -07:00
Danny Tuppeny 33824188a0 [analysis_server] Disallow inlining SDK code
Fixes https://github.com/dart-lang/sdk/issues/60308

Change-Id: Ic813b309f57464f16e3285e594ec4ec18f14f4e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442120
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-07-24 13:00:15 -07:00
Danny Tuppeny 02ea7d0b14 [analysis_server] [lsp] Support return/yield/break/continue in Document Highlights
This adds support for keywords like `return`, `yield`, `break`, `continue` to Document Highlights. For break/continue, the matching loop keyword (`do`/`while`/`for`) is also highlighted (and this works in both directions). This behaviour matches what I see for TypeScript in VS Code.

This is only supported for LSP because the legacy protocol groups these by "Elements" which we don't have for loops (though since IntelliJ uses its own data for occurrences, it's not clear to me if anyone is using Occurrences over the legacy protocol).

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

Change-Id: I5563ec0a91a6fe33d10a6317d33e9256b3c50209
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442061
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-07-24 10:47:40 -07:00
Konstantin Shcheglov 945346292f Move check for setter formal parameters to AstBuilder.
Now every setter after parsing has exactly one required positional
formal parameter. This will cause setter elements have exactly one
formal parameter, and let us avoid checking for it in multiple places.

Remove CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER

Add ParserErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER

Change-Id: I80a6f3f6e51ac2ed2f6ddb49d059c2d78ff64b2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441830
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-07-24 07:21:26 -07:00
Fedor Shcheglov f47cc4487b Remove Xyz2 suffix getters from /analysis
Change-Id: I10221b86f63ee8a2d74938ef0438945b43e11f6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441990
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-07-24 05:54:30 -07:00
Kallen Tu b1af1bdd0a [analysis_server] Dot shorthands: Update RemoveConst fix.
Updates `RemoveConst` fix to handle dot shorthands. Will remove `const` where it can't be constant and then push the `const` into a dot shorthand's arguments if possible.

Bug: https://github.com/dart-lang/sdk/issues/60994
Change-Id: Idb7ef4e5006c6561ce621a48e8351fd65b27c5b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441863
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-07-24 00:14:59 -07:00
Sam Rawlins e4e36a396b DAS plugins: Make a constraint on the analysis_server_plugin package instead of the others
Fixes https://github.com/dart-lang/sdk/issues/61182

Change-Id: I46cff3e599ae63fb718a1e05778afa05be50ab79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441835
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-07-23 17:02:02 -07:00
Danny Tuppeny e885432d5f [analysis_server] [lsp] Support navigation from return/break/continue/yield to loop/function
This adds navigation support via Go-to-Definition for LSP for these keywords, matching similar behaviour in other languages (like TypeScript) in VS Code.

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

Change-Id: I30601b54c8ed7235b7789582032b9565618f2148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441520
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-07-23 09:26:29 -07:00
Danny Tuppeny c235fadc99 Fix some EOL bugs + remove useLineEndingsForPlatform=false from refactor tests
Some additional work towards https://github.com/dart-lang/sdk/issues/60234, along with a couple of small fixes for issues uncovered while getting the tests running with \r\n.

Change-Id: Iff3700fad017825f65d64195d844b1694163456a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-07-23 09:12:53 -07:00
Kallen Tu e776c1ff48 [analysis_server] Dot shorthands: Update AddConst fix to add const to dot shorthand constructor invocations.
The `AddConst` fix is triggered by the `PreferConstConstructors` lint and this CL updates the fix to add `const` to dot shorthand constructor invocations that can be made constant.

Fixes: https://github.com/dart-lang/sdk/issues/61163
Bug: https://github.com/dart-lang/sdk/issues/60994
Change-Id: I4520c1edf807c041f38f5477f48ab1b1327732b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-07-22 10:10:30 -07:00
Kallen Tu 35b09df976 [analysis_server] Dot shorthands: Update ReplaceWithVar fix and assist.
When the initializer of a variable declaration is exactly a dot shorthand, we can insert the declared type in front of the dot shorthand to ensure that we're retaining the necessary context type.
`E e = .a;` -> `var e = E.a;`
In other cases such as typed literals and constructor invocations, the correction already does what we need it to.

When we're looking at a for-each and the iterable is a typed literal, if there's a dependent dot shorthand, we add explicit type arguments to the literal to retain the context type.

Added tests for the fix and the assist which has the same code path.

Bug: https://github.com/dart-lang/sdk/issues/60957, https://github.com/dart-lang/sdk/issues/60994
Change-Id: I31a05f10a7cdaae731c6f6c59deae12c2543a4a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-07-21 17:02:03 -07:00
Brian Wilkerson 82a01bb69c Add a custom LSP request to produce a summary of a file
The exact format of the summary is yet to be decided, but at the moment
it's producing an abbreviated form of Dart that doesn't include function
bodies or documentation comments.

No attempt is made to remove in-line comments, but we might want to
consider doing that.

Change-Id: Iec6e27c54e3099a596d50d5c461356006694690b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440682
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2025-07-21 15:45:39 -07:00
Danny Tuppeny 6477e0ebae [analysis_server] Add basic configuration for controlling which inlay hints appear
Fixes https://github.com/dart-lang/sdk/issues/60326

Change-Id: Ic3247420ddc23cda6c4e459a6992721ab814f8dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-07-21 13:30:46 -07:00
Kallen Tu 676a40ec54 [parser] Dot shorthands: Recover as a DotShorthandPropertyAccess rather than a PrefixedIdentifier.
This change mainly has side effects for code completion, making sure we're suggesting the right members. When the user writes something like `E e = .^` where `^` is the cursor, they're most likely intending to write a dot shorthand.

So this parser recovery change ensures that we recover as a dot shorthand node and not as a prefixed identifier (missing it's target) in the analyzer. We don't need special casing in the code completion pass to handle dot shorthands in the prefixed identifier visitor now.

The CFE should have no notable changes, but I added a few tests since it uncovered some crashing behavior. The duplicate errors have always been the case even prior to this change.

Bug: https://github.com/dart-lang/sdk/issues/59836
Change-Id: I6c4a9f2c8cc376e4dedd715af76967da471aa681
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439140
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-07-21 11:45:32 -07:00
Danny Tuppeny 267488a405 [analysis_server] Remove useLineEndingsForPlatform from statement completion tests
+ fix related bugs in the implementation.

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

Change-Id: I2a2b1aef1380b77016e672e0d3b53d3049249105
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441542
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-07-21 11:14:12 -07:00
Samuel Rawlins 50bb4721d3 Revert "Revert two recent changes to no_literal_bool_comparisons:"
This reverts commit cb3017cb9c.

Reason for revert: Re-landing two commits together.

Original change's description:
> Revert two recent changes to `no_literal_bool_comparisons`:
>
> * "[DAS] Broadens the scope of `no_literal_bool_comparisons`"
>   commit 0541ad3828.
> * "[DAS] Fixes broken cases for "Convert to boolean expression" fix"
>   commit 04448385dd.
>
> The first commit may have lead to broken customer tests. See
> https://github.com/flutter/flutter/pull/172087.
>
> Change-Id: Iba2c936a32ecf678318fa3aea929787dca046e09
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440261
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>

Change-Id: I82594e3a77404dc0a4e22f44dd9f850f05f94ca5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-07-21 09:20:51 -07:00
Konstantin Shcheglov 3c60075478 Elements. Switch away from TypeAliasElement.aliasedElement
Change-Id: I2ddc4c1a850871d63c0b12f0a14293fff888d523
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-21 09:15:04 -07:00
Konstantin Shcheglov c4f4dcbe6a Elements. Inline FragmentedXyz mixins into ElementImpl classes.
This significantly simplifies hierarchies at cost of a few duplications.

Change-Id: I72bfe4d2af1fab1cabf6226b102d2bd32b146272
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441244
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-18 15:49:48 -07:00
Kallen Tu 53991691f8 [analysis_server] Dot shorthands: Extract expression tests.
Adding logic to add a type when extracting locals or methods, otherwise we're refactoring shorthands into a statement with no context.

Tests for mixins, extension types, enums and classes.

Bug: https://github.com/dart-lang/sdk/issues/59836
Change-Id: I8ee1407ba82118831e3bbb092e11a44b6ea5384c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431950
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-07-18 12:54:09 -07:00
Konstantin Shcheglov 6f0909d8e2 DAS. For foo.name and foo.name() include ElementMatcher(s) for supertypes too.
Change-Id: I46c88a185af73951d46815053c997984735b853a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-17 12:56:19 -07:00
Paul Berry ad503267f1 [analyzer] Remove format method; change callers to use formatList.
This method wasn't exposed through the analyzer public API, and wasn't
strictly necessary; all it did was wrap up all its arguments (except
the first) in a list and call `formatList`.

In the long term I intend to replace `formatList` with a richer and
more type-safe API that allows clients to supply message parameters
through named parameters. Removing the `format` method now will make
it easier to evolve towards that richer API.

Note that this change is not strictly a no-op; one of the call sites
(in
pkg/analysis_server/lib/src/services/refactoring/legacy/inline_local.dart)
was incorrectly wrapping its argument in a list and then calling
`format`, causing the argument to be wrapped in a second list. That
was clearly a mistake, so I went ahead and fixed it as part of this
CL.

Change-Id: I0796804ab949e66a129bfeec6dfe688dfa113eb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440548
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-07-16 10:12:11 -07:00
Fedor Shcheglov 6a5c577465 Rename / deprecate more getters and methods.
* Deprecate `DirectiveUriWithLibrary.library2`, use `library` instead.
* Deprecate `ElementAnnotation.element2`, use `element` instead.
* Deprecate `LibraryImport.prefix2`, use `prefix` instead.
* Deprecate `MultiplyDefinedElement.conflictingElements2`, use `conflictingElements` instead.
* Deprecate `ScopeLookupResult.getter2`, use `getter` instead.
* Deprecate `ScopeLookupResult.setter2`, use `setter` instead.

Change-Id: I523eb21d194b661eed5bcbbfc923e9a7de87c962
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440361
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-07-15 15:10:55 -07:00
Sam Rawlins cb3017cb9c Revert two recent changes to no_literal_bool_comparisons:
* "[DAS] Broadens the scope of `no_literal_bool_comparisons`"
  commit 0541ad3828.
* "[DAS] Fixes broken cases for "Convert to boolean expression" fix"
  commit 04448385dd.

The first commit may have lead to broken customer tests. See
https://github.com/flutter/flutter/pull/172087.

Change-Id: Iba2c936a32ecf678318fa3aea929787dca046e09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440261
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-07-14 12:57:34 -07:00
FMorschel 04448385dd [DAS] Fixes broken cases for "Convert to boolean expression" fix
Fixes: https://github.com/dart-lang/sdk/issues/60614
Change-Id: Ib083c4150cacc4e0e8cf3a2a37916fd5894d116b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440203
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-07-14 10:30:54 -07:00
Danny Tuppeny f8d6ad7e4b [analysis_server] Don't generate inline values inside function types
We shouldn't treat parameter names inside function types as if they are references to other parameters/variables of that name.

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

Change-Id: Iadc97723a87af1ddbbde618d1c9c8e5b51499a6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440160
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-07-14 08:16:00 -07:00
Fedor Shcheglov 8cfa901c6e Rename nameOffset2 to nameOffset
Change-Id: I3c8051840122b6046bc89ed48ec329c825607fe5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440180
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-13 20:44:49 -07:00
Konstantin Shcheglov 53985966cf Elements. Remove LocalVariableFragment.nameOffset
It was deprecated in https://dart-review.googlesource.com/c/sdk/+/440141

Change-Id: Id63129f32baf1efe778d5be20e13b11f5224b69a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440120
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-12 17:07:50 -07:00
Fedor Shcheglov 238cd4c20a Deprecate constants2, lookUpInheritedMethod2, lookUpInheritedMethod2, classes2, classes2, extensionTypes2, extensions2, functions2, libraryExports2, libraryImports2, libraryImports2, mixins2, topLevelVariables2, typeAliases2, join2, isNonSubtypableClass2, and typeParameters2.
Change-Id: Ia4b5504d91548b561e2e2434e711c40b2dc5e495
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-07-12 16:23:12 -07:00
Keerti Parthasarathy 069e30a495 [Completion] Move the legacy completion handler to using SuggestionCollector.
As discussed, test results have changed to

- include all suggestions containing the prefix instead of starting with the prefix
- suggestion kind is now 'prefix' instead of 'library'


Change-Id: Ica5fe62eaf8d4d0741af112810977f122457759f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439345
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2025-07-11 12:24:49 -07:00
FMorschel 0541ad3828 [DAS] Broadens the scope of no_literal_bool_comparisons
Fixes: https://github.com/dart-lang/sdk/issues/60614
Change-Id: I949cc9790468ccd14a1354c92945138310b5a659
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430901
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-07-11 12:10:29 -07:00
Konstantin Shcheglov c87169ef1a Remove InfoDeclarationStore.
I believe it is less useful now with workspaces, and adds unnecessary
complexity.

Change-Id: Ifd9b0bbcfd764c42fb0270a2d98ee4f0a6b58015
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439824
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-10 14:34:42 -07:00
Lasse R.H. Nielsen 1afbc51874 Add type support to data-fix replacedBy.
Still missing extension type support.

Change-Id: Ida582e6f5832d2ee0a648f0aecb9e8c50c0ee8e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432982
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-07-10 01:06:23 -07:00
Fedor Shcheglov 7218145cd2 Deprecate appendToWithoutDelimiters2, correspondingSetter2, unnamedConstructor2, getNamedConstructor2, entryPoint2, exportedLibraries2, getClass2, getEnum2, getMixin2, exportedLibrary2, accessibleExtensions2, importedLibraries2, importedLibrary2, isImplementableIn2, join2, variable3, getter2, setter2, correspondingGetter2, superConstructorParameter2, aliasedElement2, typeParameters2, constantInitializer2, and isNonSubtypableClass2
Change-Id: I091804b9f200f525baf3979773dd489e3be17697
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439640
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-07-09 20:34:14 -07:00
Konstantin Shcheglov 37bce89a04 Elements. Use FragmentImpl.nameEnd instead of nameLength.
Change-Id: If02b26cd8e1346aa34c8978dc286499975905a95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439547
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-07-09 14:36:53 -07:00
Fedor Shcheglov 933f3da0f7 Deprecate appendToWithoutDelimiters, correspondingSetter2, unnamedConstructor2, getNamedConstructor2, and typeParameters2
Change-Id: I42dcff17c5bb0c9d6c3ae55dcdd4df85d83cd076
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-07-09 11:13:07 -07:00
Fedor Shcheglov 1a88edceb7 Deprecate redirectedConstructor2, superConstructor2, children2, displayString2, getExtendedDisplayName2, isAccessibleIn2, thisOrAncestorMatching2, thisOrAncestorOfType2, constants2, field2, typeParameters2, children3, asInstanceOf2, instantiateInterfaceToBounds2, and instantiateTypeAliasToBounds2.
Change-Id: I82004d5d1c758aae51ec8c97645aa53ed8cc52bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439383
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-07-09 07:13:51 -07:00
Fedor Shcheglov 247ae2364f Deprecate Element.name3, use name instead.
Change-Id: I24a5e4a519b9f3bf755912f21a5c192edd1dd4ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439381
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-07-08 14:13:49 -07:00
Fedor Shcheglov 14de1522e1 Deprecate Fragment.name2, use name instead.
Change-Id: Ic0506f50e9dc752b7e8e28f4299426be47407d4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439081
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-07-08 09:17:39 -07:00
FMorschel 2419e97604 [DAS] Fixes create method, create getter and create mixin fixes
Fixes: https://github.com/dart-lang/sdk/issues/60826
Change-Id: I16cb1db16bcb8d7e57cb92723f058302f347e40e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-07-08 09:14:41 -07:00