Commit Graph

7568 Commits

Author SHA1 Message Date
Danny Tuppeny ff0cd5e0d6 [analysis_server] Don't warn on renames of private named parameters
Fixes https://github.com/dart-lang/sdk/issues/63433

Change-Id: I6e39d3b8c9379df07a677cabfcd9028a7bca79db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510840
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-10 11:57:21 -07:00
Sam Rawlins 088614d11b DAS plugins: Export types from analyzer_plugin for convenience
Fixes https://github.com/dart-lang/sdk/issues/61821

Change-Id: Ibb2737553de713aeef725a19417e09202bee8ac3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509543
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2026-06-10 09:38:40 -07:00
Danny Tuppeny eb979c2f0c [analysis_server] Don't show field modifiers in signature help for primary constructors
Fixes https://github.com/dart-lang/sdk/issues/63560

Change-Id: I2c93e4a1011075e103d9165d0664f588f3109c40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510821
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-10 09:03:48 -07:00
Jake Macdonald 7c3c71ae4d Don't lint on raw types in constant patterns if the matched type is of type Type.
The issue does not have total consensus but I do feel strongly and the
fix was trivial and so I am just sending this out.

Feel free to push back if you feel strongly, or I should go through some
formal process.

Bug: https://github.com/dart-lang/sdk/issues/59334
Change-Id: I7c5e25e9754c4cebd427b8dc9ccfbe8daa57e71a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510460
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2026-06-10 08:23:43 -07:00
Kallen Tu 2a3c26806f [migrate] Allow additional force enabled codes in BulkFixProcessor.
This CL allows the BulkFixProcessor to handle additional force-enabled
codes that may not be enabled in the existing analysis options of the
current project.

Change-Id: I346a1fba8a25d7ebc6a2d95828796e7f7c0ff52c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509681
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-09 11:29:45 -07:00
Varad Raj Agrawal 6a678d1f49 Quick fixes that create constructors use new-style syntax when primary_constructors is enabled
Closes https://github.com/dart-lang/sdk/pull/63534

GitOrigin-RevId: 345471bc33c002bbca9cea9c6626a05f481f70e3
Change-Id: If8d533ab0bbb4e6dff51a4256101fb8cb0490fb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509680
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-09 10:57:01 -07:00
Parker Lougheed a1160684d9 [analysis_server] Remove class modifiers in convert_class_to_enum fix
The class modifiers aren't valid on the resulting enum declaration.

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

Change-Id: Idd8ed4fcfae071d21f25811b2158cfad3178fef5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509880
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-08 09:11:55 -07:00
Danny Tuppeny 6fed0f7527 [analysis_server] Remove some unnecessary code related to original interactive refactors
When we built the added the original interactive refactors support, we supported the client telling the server which field kinds it can prompt for, so that if there were questions the client didn't support that did not have default values, the refactor could be hidden.

However, we only implemented one such refactor (Move to File) and the only field (destination URI) has a default value, so the client capabilities never have any effect.

Since we're replacing this support with the new "Interactive Forms" and don't intend to create any new refactors using the old system, this code is all redundant and therefore can be deleted.

Change-Id: Ic940dc54e325ccab05b28f496dbedee76e17e0b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509460
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-04 11:29:49 -07:00
Danny Tuppeny dbe61d2ece [analysis_server] Support prompting for name for "Add Constructor Name" refactor
Similar to the previous CL for Add Import Prefix, this adds support for prompting for a name for "Add Constructor Name" if Interactive Forms are available.

Change-Id: I952695df03016a549345f329ac04961d7c279af1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-04 10:41:49 -07:00
Danny Tuppeny 8f30cb7e43 [analysis_server] Support prompting for name for "Add Import Prefix" refactor
If the client supports Interactive Forms, this will allow prompting for a name for the import prefix instead of using "prefix" (or "prefix1", etc.).

Includes moving some boilerplate out of each refactor into `ParameterizedRefactoringProducer` and support for a custom validation function for form fields (to validate the import prefix name in this case).

Change-Id: I7150664a18944c723eeeac0a309341af2860201f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-04 10:41:15 -07:00
Danny Tuppeny f024b20e9a [analysis_server] Fix filters + resource type for Move to File in Interactive Forms
1. The `filters` field is specified/implemented as just file extensions, not patterns
2. We need `type: FileType.Regular` to stop you selecting directories as the target for the move

Change-Id: I39397ff844c91bbbfbbd8c070bc29ce2db371d73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508921
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-04 06:54:49 -07:00
Brian Wilkerson 984ce37109 Fix convertToInitializingFormal to rename references to the parameter
The fix was previously missing logic for renaming references to the
parameter when the field name is private. This CL should fix that.

Closes https://github.com/dart-lang/sdk/issues/63505

Change-Id: Ic4435414adbbf7a625b2c7c47e0a41136c4c58b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509160
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-03 21:10:21 -07:00
Danny Tuppeny f1ceed2ba7 [analysis_server] Add command/resolve to support using Interactive Forms in refactors
This adds support for the `command/resolve` request to support the new Interactive Forms functionality, and updates the refactor processes to use it instead of the original protocol when the client indicates support.

Currently only the "Move to File" refactor uses this functionality (matching the previous version) and it requires the `dart.experimentalInteractiveForms` setting be enabled for it to be used (in case we find bugs while developing the front-end that require incompatible changes).

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

Change-Id: I414a41fa2958ca9dcefe097f35ba28f3fa2fe367
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508121
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-03 08:47:33 -07:00
FMorschel ab017d3bda [linter, DAS] Adds new diagnostic opposite of unnecessary_await_in_return
Bug: https://github.com/dart-lang/sdk/issues/62555
Change-Id: Ica84ea93efcb2c74d2fd260cdceebbf6558e7bf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/477660
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: FMorschel <git@fmorschel.dev>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-02 15:06:00 -07:00
Brian Wilkerson a75be76daf Fix bug in convertIntoBlockBody
I ran across this bug while testing to see what work was already done.
I didn't take the time to create an issue.

The bug is that an assist was being offered for `class C ^{}` to
convert the class body into a block. The result, for an empty block,
was just to add an extra space before the block body. For a non-empty
block, the result was to delete everything inside the block.

Change-Id: I0342b681ef67b5e659a00126a998d63d593223fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508702
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-02 13:04:55 -07:00
Brian Wilkerson dd66887ed7 Add an assist to move a field initializer into the declaration
The assist was originall written as a fix, but it's on the list of new
assists that we think users would find useful, so I made it also work
as an assist. The tests are just a copy of the tests for the fix.

The assist is available when the cursor is inside the name of a field
on the left side of a field initializer.

Unlike the lint, which only flags initializers if there is a reference
to a constructor parameter on the right side, the assist will move any
initialization expression. I think that's reasonable, but let me know
if you think we should limit it.

Change-Id: I4f6d90dbd510d5c93f0087933741d298939d4a49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508680
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-02 10:19:20 -07:00
Sam Rawlins 02ecbc8cf2 Report and offer fix for wildcard stack trace variable
Fixes https://github.com/dart-lang/sdk/issues/55738

Turns out there are many unused StackTrace variables here and there in
our tests, so those are ignored in a few files.

Change-Id: Iff9d0db265b96aca608261cb4518b372255d19cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501223
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-01 15:55:44 -07:00
Sam Rawlins 7dab27015c DAS plugins: Respect analysis roots set in LSP
Fixes https://github.com/dart-lang/sdk/issues/62686

This is the remainder of the work from https://dart-review.googlesource.com/c/sdk/+/505041 for LSP. With this change, "workspace folders" from LSP are sent as analysis roots to new analyzer plugins.

Change-Id: Ic79503532fca1291097128ac0085c09bbeabbc4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508168
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-01 14:01:53 -07:00
Danny Tuppeny 336ad52179 [analysis_server] Fix handling of default values in unanswered Interactive Forms
This fixes a bug where an interactive form where all fields have defaults would be considered complete immediately, so we'd never present the fields to the client.

It also includes some minor refactoring extracted from a future CL that implements command/resolve and supports Interactive Forms in refactors in an attempt to reduce the size of that change to aid reviewing.

Change-Id: I176fe25dbb0b610d69617fa04562b0d3ce571642
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-01 12:43:19 -07:00
Danny Tuppeny c0b424f28f [analysis_server] Update interactive forms for latest spec changes
This updates the interactive forms classes to reflect recent changes.

Previously, we would only send back the outstanding fields to the client, and it would only provide answers for the same.

Now, the server will always send all fields to the client, and the client will always provide all answers. Answers are looked up IDs (a new field on `FormField`, and `FormAnswer` which wraps the answer) rather than rely on indexes.

Fields can also now be required.

Change-Id: If4aa1f9a18fa873e83cb0ea1fd74c2e42cd2fa1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508103
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-01 11:46:51 -07:00
Brian Wilkerson ff974a38b5 Fix a bug in convertDefaultToPrimaryConstructor
The convertDefaultToPrimaryConstructor fix wasn't accounting for the
presence of type parameters when choosing where to insert the empty
parentheses. This fixes that.

Closes https://github.com/dart-lang/sdk/issues/63482

Change-Id: Ibec4f5531840bf0c0aafa4436654201ef8a8a6ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508202
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-06-01 11:00:32 -07:00
Danny Tuppeny 0bb9fa32a5 [analysis_server] Fix isolate plugin test on Windows
Fixes:
  Expected: ['/pkg1']
  Actual: ['C:\\pkg1']
   Which: at location [0] is 'C:\\pkg1' instead of '/pkg1'
Change-Id: I6bd2abaa77eea7193794ece126201958e11639db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-01 07:24:26 -07:00
Brian Wilkerson 8a5987013f Add a new fix for representationFieldModifier
This add a fix to add a type annotation in place of the `var` keyword.

The assist to add a type annotation was already being offered, but it
didn't understand that it needed to also remove the keyword. The added
fix will do both, and, by being a fix, will appear higher in the list
of code actions that users see, along side the fix to remove the
keyword without adding a type annotation.

The fix to remove the keyword can be bulk applied, so I couldn't make
the new one also be bulk applicable. We might consider reversing the
status so that the default bulk fix behavior includes adding a type
annotation, but this CL doesn't do that.

Change-Id: I122221ef1e5119a76e1157a9a15cf1193135fc59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507161
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-29 17:02:11 -07:00
Brian Wilkerson e13ffe9aff Fix a bug in the member sorter
Because of the reversed condition, the priority for primary constructor
bodies wasn't being added when the lint was disabled, causing it to not
be moved, resulting in seemingly inconsistent results.

Change-Id: I5110e39e066414e04bb69f61b3aa7189875469f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507460
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-29 12:57:43 -07:00
Brian Wilkerson 2c8106a52c Support converting function-typed parameters to an initializing formal
This addresses a comment on a previous CL by implementing the logic
required to handle the case where the declaring parameter has an old
style function type.

Change-Id: Ie65cc379571800b0d3d5acec82341d315e80ed4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507162
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-29 06:52:08 -07:00
Paul Berry afcfbbeba8 Migrate developer experience packages to new constructor decl syntax.
(Part of https://github.com/dart-lang/sdk/issues/63288)

This change migrates the packages owned by the developer experience
team to use the new constructor declaration syntax, described in
https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md#abbreviations-of-in-body-constructor-declarations.

This change was performed in an automated fashion, by (a) bumping the
packages' SDK constraints to `3.13.0-0`, (b) enabling the lints
`unnecessary_type_name_in_constructor` and
`unnecessary_const_in_enum_constructor`, (c) fixing the resulting lint
failures using `dart fix`, and then (d) reformatting the affected
files.

To ease code review, I've reverted unrelated formatting changes.

Since this change requires bumping SDK constaints to `3.13.0-0`, it
was only performed on packages that are *not* published on
pub. (Packages that *are* published on pub should remain on lower
language versions until at least after the stable version of 3.13 is
released, so that we don't block users on the stable channel from
receiving updates to those packages.)

Change-Id: Ibb4daebafd239da58251e838ea6a3f336a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505046
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
2026-05-27 14:52:58 -07:00
Brian Wilkerson 8b555128be Support converting a declaring param to an initializing param
Server already supports the opposite, so this just makes it possible to
go both ways.

This doesn't support converting a declaring function typed parameter.
We could add that, but I'm hoping it's rare enough to not be worth doing.

Other than that, I think I've covered all the cases, but please pay
special attention to the test coverage.

Change-Id: I400204ca820d0e0f1cc44075dd54946db79b2115
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506740
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-05-27 14:39:09 -07:00
Robert Nystrom 2cd3ec552c Fix "Convert to a primary constructor" on generic classes.
It would incorrectly put the primary constructor parameter list before
the type's type parameter list, like:

```dart
// Before:
class C<T> {
  C();
}

// After:
class C()<T> {
}
```

This fixes it to follow the type parameter list if there is one.

Change-Id: Ib49c7df7923e9feed11f87579fefc8300c56c4a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2026-05-27 13:59:34 -07:00
Sam Rawlins d0f27293ce DAS plugins: Respect the analysis roots set by "dart analyze"
Work towards https://github.com/dart-lang/sdk/issues/62686

`dart analyze` uses an 'analysis.setAnalysisRoots' "command" to let
the analysis server know that the user requested, for example,
`dart analyze foo` or `dart analyze foo/bar.dart`. This was not conveyed
to analyzer plugins, so analyzer plugins will always analyze the entire
context collection.

(For some reason, only files in the "analysis roots" were reported in
stdout; maybe DAS or dartdev does its own filtering on diagnostics.)

This change forwards the `setAnalysisRoots` request to DAS plugins using
a new protocol message that mirrors the one for the server.

We should not change the behavior of `analysis.setContextRoots` for
legacy plugins, so we keep sending that request as per usual. Then
we send `analysis.setAnalysisRoots` at the same time.

If we receive an `analysis.setAnalysisRoots` message, dispose and
delete references to the existing context collection, and instantiate
a new one, with the specified `included` and `excluded` paths.

Change-Id: I53627da1c30351a22b5e5410a557bf486620a7aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505041
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-05-27 13:47:02 -07:00
Sam Rawlins 0fa39c9649 linter: Switch cascade_invocations to report once for a set of cascadable statements
Fixes https://github.com/dart-lang/sdk/issues/58688

Change-Id: I022b58109deedfbd6e57e6aa5159942081e6d8fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/503941
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-05-27 08:58:12 -07:00
Brian Wilkerson ec40ebcd23 Fix a bug in textDocument/definition for primary constructors
Change-Id: Id24cdfda1c84322b5fa77cca0c87df0784482ec6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506080
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-22 17:05:29 -07:00
Brian Wilkerson 03a05b52d8 Fix a primary-constructors bug in ElementMatcher
The element matcher threw a null check exception when getting a matcher
in the argument list of a constructor redirect in a secondary
constructor declaration with no explicit type name. This fixes it so
that no exception will be thrown.

That said, it isn't clear to me that this code could ever be reached
outside of the tests. There might be a lot of unreachable code in
ElementMatcher. I just can't prove that this particular bug would never
have occurred.

Change-Id: I5adf9ab5d4f79686110099054902a28535483f4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505921
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-05-22 13:23:38 -07:00
Brian Wilkerson 739826d041 Update ImportedElementsComputer for primary constructors
This CL is to resolve a TODO. I couldn't find a way to trigger any bugs
in the code, but I did add a test. I believe that the reason I couldn't
trigger a bug is because any constructor that has a null `typeName`
will not have a simple identifier in a place that would allow
`_isConstructorDeclarationReturnType` to be invoked.

I realized, while looking at the code, that the type check is
unnecessary. If the type name is null, then the test will somply return
`false`, which is what we'd expect it to do. Given that it isn't needed,
I decided to remove it.

Change-Id: Ib36aaf16475db0db5817e65a8b8bfbb8aa834dbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505501
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-05-22 12:53:51 -07:00
Danny Tuppeny c8a74e71ef [analysis_server] Add classes for processing interactive forms
This adds some classes for processing interactive forms (I'm splitting this from the CL that updates refactorings to simplify reviewing).

The `InteractiveForm` class managers a whole form (all fields), and processes a set of fields/answers that come back from the client (which may be the full set, or a subset). It produces a list of the outstanding fields (which need to be go back to the client) as well as maintaining the full set of answers for the master field list (to use as arguments for a command, for example).

I've also commented out enums/lists from the protocol code for now, because I made the field kinds `sealed` so we get exhaustiveness checking in the validation, but want to delay fully implementing those for now.

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

Change-Id: Icc4dcea8c9eab20ffbdd19ebbc69e1285464f7ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505683
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-22 12:44:58 -07:00
Brian Wilkerson 1e1ecd8b41 Fix code completion before keyword in constructor
This fixes an exeception when code completing before the `new` or
`factory` keyword in a constructor and the type name is not explicitly
used. The exception prevents any suggestions from being returned, so
it's fairly serious.

Change-Id: I2f5028812ee1945ac9635f55953fb800b19a48c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505620
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-22 10:25:06 -07:00
Konstantin Shcheglov d6c87cc934 Always verify constants in LspEnum.
Change-Id: I4d62eacbf97c5f83e0eab378bc7d239ab934e6b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505623
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-05-22 08:59:05 -07:00
Danny Tuppeny 5a40aaaecc [analysis_server] Fix isAvailable check for "Remove constructor name" on unnamed constructor invocations
This code was checking the name of the type instead of the name of the constructor.

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

Change-Id: I180940162aa7ff12e4ec19aa002a188961d7aad5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505684
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-22 08:26:51 -07:00
Danny Tuppeny 026043d9ed [analysis_server] Add helper functions to support flags enums
In the new interactive forms, some of the enums can be combined (eg. `FileExistence.New | FileExisting.Existing`). This adds a flag that produces some helper functions for `hasFlag()` and `combine()`.

These helpers are not used outside of tests in this CL but will be used in a future CL (which I'm trying to avoid getting too big to simplify reviewing).

Change-Id: I1b5f06f05d96781c4bc6a246a0a9309a786c1987
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505320
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2026-05-21 13:06:43 -07:00
Brian Wilkerson f2319d4ed4 Support fixing codes not enabled in the options file
Codes specified on the command-line are force-enabled in all of the
analysis options for all of the files. This is done in a brute force
way, but it should be safe because the code is creating an analysis
context collection just for this one run, so the options objects
should be short lived.

Closes https://github.com/dart-lang/sdk/issues/63345

Change-Id: I8925da426d6cb5b9ce686725e3b95696b552cae0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505045
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-05-21 12:57:18 -07:00
Brian Wilkerson 48dc2edf14 Remove an unused method from a test class
Change-Id: I8022c0d06009b7a0e672260cd31c8f7618bd124a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505382
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-05-21 11:50:14 -07:00
Keerti Parthasarathy ea3fb4d69a [analytics] Fix issue where fields from env variables were not populated
Bug: https://github.com/dart-lang/sdk/issues/63246

Change-Id: I9956cbfc7e4718727558727990e61baa59436ad5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505051
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-05-20 21:02:10 -07:00
Konstantin Shcheglov fb2962c045 Issue 63382. Use WorkspacePackage.isInTestDirectory() instead of CompilationUnitExtension.
Bug: https://github.com/dart-lang/sdk/issues/63382
Change-Id: I3c1d2495f9cb6804c73d1f36314556186f825a67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505064
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-20 14:39:04 -07:00
Danny Tuppeny bb220724dc [analysis_server] Convert LSP spec tests to test_reflective_loader
No functional changes, this just converts the tests from group/test to test_reflective_loader to match other tests.

Changing the group()/test() calls to methods results in the tests being re-sorted by member name.

To possibly simplify reviewing, I've pushed this to Gerrit as two patch sets:

- PS1: does the conversion but includes index numbers in each test to preserve the order
- PS2: removes the index numbers and re-orders the tests

Change-Id: I72ebe3d3066b181a77052bec5082e4bd34066939
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504580
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-05-20 13:05:22 -07:00
Keerti Parthasarathy d3f4debece [dart fix]Fix adding package to both dependencies and dev_dependencies in pubspec.
Closes https://github.com/dart-lang/sdk/issues/63409

Change-Id: I51258cf986b9b60a8d7add58f7737d6c8bf9f1ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505040
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-05-20 12:56:57 -07:00
Konstantin Shcheglov 39fcaa5d01 Augment. Allow 'static abstract' fields.
Change-Id: I42c4bbb9193c2debd3661898a8c410f76916958a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-05-20 08:49:01 -07:00
Sam Rawlins 5f2c7f7ef0 DAS: Replace RequestConverter with extensions
Preliminary work before introducing a 'setAnalysisRoots' request

Also remove inferred types, in the tests. Very old style.

Change-Id: Id4495702419f1e219f758c509fdc617f6d411d54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504761
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-05-20 07:36:29 -07:00
Kallen Tu efd30a2de0 [migrate] Initial implementation of SDK constraint bumping.
Uses the pubspec util `computeVersionBumpEdit` that bumps the pubspec
file's `sdk:` one minor version up.

Very basic iteration through the given pubspec files to bump all of
them. We'll very likely have to refactor this as we get the pre/post
migrations involved, but I wanted to get there in small (reviewable)
steps.

Bug: https://github.com/dart-lang/sdk/issues/63268
Change-Id: I2a7abeacdc76b114dfef7888cd6db6bc8973d01a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504381
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-05-19 14:11:50 -07:00
Danny Tuppeny 0888111999 [analysis_server] Add protocol classes for new interactive forms
Change-Id: Iefb251c2a4982bf4118430e0f2885f248e1b5a57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504540
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-05-19 12:23:39 -07:00
Danny Tuppeny ddeb964d80 [analysis_server] Handle some reserved names ("default", "new") in LSP codegen
Both of these names are used in the JSON in the Go-spec'd refactoring support, so we need to map them to new names.

We had some existing code for mapping some kinds of names (like enums), but not for JSON fields in interface classes.

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

Change-Id: Ic223a783be9170774444844bb1934a3733ddf446
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504261
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2026-05-19 12:12:02 -07:00
Kallen Tu 7ca32bdbbf [migrate] Refactor version bumping from update_sdk_constraints to a util file.
This is a prerequisite CL to the next one that will add version bumping
to the dart migrate tool: https://dart-review.googlesource.com/c/sdk/+/504381

Refactoring the version bumping logic out of `update_sdk_constraints` so
it can be shared between the correction producer and the migrate tool.

`PubspecEdit` also contains the old and new versions so the migrate tool
can refer to those in its summary text.

Bug: https://github.com/dart-lang/sdk/issues/63268
Change-Id: I488cf10694b89df1ed770ee0f27f13a00d1dd3be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504340
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-05-18 14:40:27 -07:00