Commit Graph

10708 Commits

Author SHA1 Message Date
Sam Rawlins 32a4214f93 DAS plugins: Add a note indicating that plugins with build hooks are not supported.
Work towards https://github.com/dart-lang/sdk/issues/62351

Change-Id: I41549b5b85bdab558f05d6a55d5c83c777d48116
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2026-01-13 15:33:59 -08:00
Sam Rawlins 25f0d80c15 analyzer: Refactor how the mock 'dart:ui' library is discovered
Fixes https://github.com/dart-lang/sdk/issues/62234 by making the
'dart:ui' library discoverable in the same way that the real one is
discoverable: by the sky_engine _embedder.yaml file.

Coupled with this change is the motivation: the stubs are out-of-date,
with `double width` and `double height` parameters on the Preview
constructor. But this has been changed to use a `Size` object, and
`Size` is written in 'dart:ui'. So to write a test that uses `Size`, the
test now needs proper access to 'dart:ui', and we should not write
'package:ui/ui.dart' in our test cases. These changes are in
`.../lib/mock_packages/package_content/flutter/lib/src/widget_previews/widget_previews.dart`
and in `invalid_widget_preview_private_argument_test.dart`.

Change-Id: I6f608eb3e1f431ad576ba8f3572454e42a39f9f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-01-13 15:32:51 -08:00
Jake Macdonald ba183805c9 Small improvements/fixes for analysis server scenario replay
- Return messages that fail to parse with the error response.
- Add support for open subdirs to projects, speeds up SDK replays.
- Fix up normalize script when package deps are subdirs of the project.
- Re-record the sdk scenario with only pkgs/analysis_server open.
- Fix some bad hard coded responses that were failing to parse.
- Add extra context (extra messages recieved) when scenarios fail.

Change-Id: Idfdcde70776967c2d419e76a21a6c6d1c59902f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2026-01-13 13:51:26 -08:00
Danny Tuppeny c81574e14e [analysis_server] Fix missing named + unnamed constructors in workspace symbols
There were two issues here:

1. Class names were not part of the search for constructors, so default constructors were never returned
2. Constructor names were not added to `ElementNameUnion`, so they would also not show up unless there was another symbol in a library that caused it to pass this check

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

Change-Id: If77cb7b134925230d49ac50094adff6e74a055c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-01-13 13:05:40 -08:00
Konstantin Shcheglov 98d0db74e8 CQ. Use tryCast() instead of ifTypeOrNull().
Change-Id: I2a13f6b3a56c045cc35944360bc5a76894acf03f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472480
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-13 09:41:53 -08:00
Konstantin Shcheglov d9b88bd48c DeCo. Add PrimaryConstructorDeclaration.body and PrimaryConstructorBody.declaration to API.
Change-Id: I1164941486002ab79df70d1baf0121b3593b12b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472441
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-01-12 16:14:23 -08:00
Robert Nystrom b6c19cbe13 [private named parameters] Handle rename refactoring.
Remove the special case handling that would add a public parameter and
a separate initializer in the initializer list since you can now use the
private name as a parameter directly.

Handle updating references at constructor callsites where we need to
rename the argument to the corresponding public name.

Bug: https://github.com/dart-lang/sdk/issues/61644
Change-Id: I76160f2a702073f57a45b9ea0425e4a7567ba466
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2026-01-12 14:37:52 -08:00
FMorschel fb419269bc [DAS] Fixes dot shorthand completion for if case and &&/|| operators
Fixes: https://github.com/dart-lang/sdk/issues/62381
Change-Id: If8e161d37caf9e8c561cb28e42ae2cbe4ac7fada
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471780
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-12 11:29:02 -08:00
Sam Rawlins 683ef059f5 Add a --no-plugins option to prevent analyzer plugins from running
Fixes https://github.com/dart-lang/sdk/issues/62353

Change-Id: I902badd0a7a072b98691d88ad7b382828227b1fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-01-12 11:28:17 -08:00
Danny Tuppeny ec2b9b8699 [analysis_server] Add inlay hints tests for primary constructors
Change-Id: Icc638077078c3fe11c466b4406cbfc38955bc2d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2026-01-12 11:20:59 -08:00
Danny Tuppeny d54b0c5772 [analysis_server] Handle classes with primary constructors and no body in outline
I noticed if you use `;` instead of `{}` the class wouldn't show up at all.

Change-Id: I2c4dd6491e728c18e4ddc19125e35a5110347ae0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472224
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-01-12 11:20:14 -08:00
Konstantin Shcheglov 9bc11bd3d3 DeCo. Tests for (mostly) constructor renames in Cider.
Some of them (for newHead) are failing.

Started as a simple fix for
https://github.com/dart-lang/sdk/issues/62067 instance in utils.dart,
but got too many tests added in the process.

Change-Id: I17d4ca992c925c400f380e54cdff4d3da40c7c84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472141
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-01-12 11:04:52 -08:00
FMorschel 6d28e46ead [analyzer] Fixes class references for const invocation of named constructor
Fixes: https://github.com/dart-lang/sdk/issues/55348
Change-Id: Ib57f1c4bf9db84bb0e940fea02b480bbcd5706ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472360
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-01-12 10:54:27 -08:00
Danny Tuppeny bab16ed884 [analysis_server] Handle folding for primary constructors + some constructor fixes
Change-Id: I11174e465573c68b454d5bcd3757e1e0141c4f66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472221
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-01-12 09:08:08 -08:00
Danny Tuppeny a3a9a3dfc8 [analysis_server] Add closing labels tests for primary constructor invocations
Change-Id: I6d6a9d511c795d60220fff900b3b3358c86265a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472222
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-01-12 08:41:59 -08:00
Sam Rawlins a08b18bf55 DAS: Use a shared mock in plugin_watcher_test
Change-Id: I9a97e5dc5da3a9551e3016b4f203dcb635197d54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471888
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2026-01-09 12:37:36 -08:00
Sam Rawlins a121c7e8ec DAS: Use a shared mock in analytics_manager_test
Change-Id: I6de4772c83c97eb049edef101a41b36342bd5188
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471889
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2026-01-09 12:30:30 -08:00
Keerti Parthasarathy 00385dab24 Add a few more Flutter use cases for data driven fixes.
Change-Id: I854220c5607ff94413b8a53ffd387d1c2f092dce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471903
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-01-09 12:29:33 -08:00
FMorschel 463217e282 [DAS Plugins] Fixes diagnostic messages not showing for plugins
Fixes: https://github.com/dart-lang/sdk/issues/62357
Change-Id: I21c33c4af5f0e41fc5015c61f0bf7e2a7229a8f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471840
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-01-09 11:21:03 -08:00
Brian Wilkerson f8b2feb1ed Add documentation for the principle of consistency
This feels kind of brief, especially compared to the language fidelity
principle. In addition to improvements to the existing text, please let
me know what needs to be added or expanded on.

Change-Id: I30705acb705a4aa94c8ba2c70757d3f44e2e09b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471402
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-09 07:28:10 -08:00
Keerti Parthasarathy 93fb518dc6 Add tests for data driven fix for Flutter use case.
Based on https://github.com/flutter/flutter/pull/179776.

Change-Id: Ia80e1c4217959b8309694fa12973fdacf032fcf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471603
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2026-01-08 15:21:03 -08:00
Brian Wilkerson 1cadcbd88b Add legacy outline support for primary constructors
This might address the other outline related features, but I decided to
add tests for those separately.

Change-Id: I67b1e5a8b24a3aa8129201be58fcd321e5137859
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471344
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-01-08 14:46:30 -08:00
Jake Macdonald 4066e5b64c Get a working public github repo scenario.
- Adds support for normalizing package dependency roots using the
  package config
- Updates the project generator so it can handle multiple project roots
  and analysis contexts, as well as package configs.
- Handle sending watcher messages to the analyzer.

Removes the basic "initialization" scenario that didn't have any real
value other than being an example github project scenario.

Change-Id: I5b49effe524d325360a754296f4cc3578ad49527
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471360
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-01-07 15:26:12 -08:00
Sam Rawlins 8fe3e5244f analyzer: Greatly simplify the AnalysisOptionsMap
The general idea is to remove the need for the subclass,
`_SharedOptionsMap` and the entry class, `OptionsMapEntry`, by wrapping
a Map instead of a `List<OptionsMapEntry>`.

When we use a Map internally, the `getOptions` and `_allOptions`
implementations collapse into one. And we can set the `sharedOptions`
constructor parameter to be the `_defaultOptions` field. With these
changes, we do not need the `_SharedOptionsMap` class.

The `entries` field was previously a commonly used public API for the
AnalysisOptionsMap class, but we can replace it with a `folders` getter
and a `options` getter.

Instead of sorting the map of options on `add` (as was previously done),
we use a `SplayTreeMap` to keep the options sorted.

Change-Id: I9e51931731f4cb4382f2f61f272d53ee15529642
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471320
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-01-07 13:13:01 -08:00
FMorschel ac0be94edd [analyzer] Adds lineNumberDifference and onSameLine methods to LineInfo
Bug: https://github.com/dart-lang/sdk/issues/61186
Change-Id: Ib0584203b000103f8137901c258a86ec571ff74c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471061
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-07 10:15:29 -08:00
Brian Wilkerson c4ed22e204 Update the member sorter to handle primary constructor bodies
With these changes, primary constructor bodies will sort with
constructors (based on whether `sort_members_first` is enabled), but
will always be before other constructors.

Change-Id: If6719dedd5178c384712a5d08b4e74a38aaf54a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471280
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-07 09:29:04 -08:00
Jake Macdonald 1a0371034b Additional fixes for scenario replays
- Skip notifications from analyzer
- Hard code responses to certain startup logs if they are unexpected
- Use cli_util to show loading spinner and get sdk location
- Update normalize to substitute the sdk location
- Make id field optional on message (notifications don't have ids)

Change-Id: Ia5276eef554a3afefeae227fa7351f902d21131e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471060
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-01-06 13:34:56 -08:00
Sam Rawlins 92bebe661b DAS plugins: Begin storing analytics data
This data is collected on shutdown, the same as the legacy analytics data.

This is implementation for some of the analytics we want to collect,
specified at go/dart-analyzer-plugin-analytics.

* How many plugins are enabled for each context?
* How many lint rules are registered for each plugin?
* How many warning rules are registered for each plugin?
* How many fixes are registered for each plugin?
* How many assists are registered for each plugin?

Change-Id: I36c176737c194550e1947985576ed461fd8a1bf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452482
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-01-05 21:28:18 -08:00
Fedor Shcheglov 09dcc24207 Test that primary constructors can initilaize fields
Change-Id: Ia43d8c44c9b695f823fd80087dfd08efd47367e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470480
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-05 10:46:02 -08:00
Jake Macdonald c2dc8f62a3 Add current directory project generator
This makes iterating on things faster, with the downside of requiring a clean git tree
to avoid bashing over pending changes.

Change-Id: I5725c288f6f4f4665e9cd8cc8d91cb77d214df2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2026-01-05 09:08:53 -08:00
Jake Macdonald fb40ed857a fix the normalize tool to only replace the path of the workspace uri with the placeholder (the path appears as a bare path in many parts of the file also).
Change-Id: Idccdd218b2c25db444c01efb3ce077117eb354f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470320
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-01-05 09:03:59 -08:00
Aman Gupta ebc9f84f50 chore: Fix typos in analysis_server error messages
Closes https://github.com/dart-lang/sdk/pull/62336

GitOrigin-RevId: 9871d040bbf7c85208e61962583b209a8418ffa5
Change-Id: I7b934e1df6a667c2f43ac4ff10552a3d5fae292b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-01-05 09:00:50 -08:00
Jake Macdonald e88d67e34a add a way to manually replay server logs one at a time or send custom messages (without requiring LSP headers)
Change-Id: Id662f52df392aab65228a2b69a830ad6058ebd55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2026-01-05 08:42:00 -08:00
FMorschel 20d8f8f166 [analyzer_plugin] Fixes writing recursive type parameter
Fixes: https://github.com/dart-lang/sdk/issues/62272
Change-Id: I2370adbf51b709e8860fcc12b6678cde504f1329
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469201
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>
2026-01-02 11:26:48 -08:00
Fedor Shcheglov d36d50a95c Report primaryConstructorBodyWithoutDeclaration.
Change-Id: I14e76e514f1aeee2a171784b778d8f8747a3dada
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-01 12:14:25 -08:00
Fedor Shcheglov 884817d52d Fix case and default not appearing as suggestions inside a switch statement that contains elements
Change-Id: Ib9a2f6ec583efee33566e17cc54ce1484cf87dbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-12-30 13:01:50 -08:00
Fedor Shcheglov bf97a8dc1d Fix a crash resulting from attempting to access a null URI when running package_names lint during code actions.
Change-Id: I8ad16c5316ba08eb77109803d09b210135639be4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470060
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-12-29 18:05:10 -08:00
Fedor Shcheglov bf5cfaedd9 Renamed variables, formal parameters, and declared identifiers that were incorrectly named elements, when they had a fragment type.
Change-Id: Id201a1f319ee2ae1e328c1d551a98df97bdc2b5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469640
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-12-29 18:04:29 -08:00
Fedor Shcheglov c854455f62 Fix a bug where renaming a field formal parameter would not rename the field formal parameter in subclasses or superclasses.
Change-Id: I43a11195e08b66b561e7bb163a62d00bb5c3dc03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469520
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-12-22 14:58:19 -08:00
FMorschel 10147534f4 [DAS] Fixes go to imports for annotations constructors
Fixes: https://github.com/dart-lang/sdk/issues/62258
Change-Id: Ia9c068ff7ea731953c91125aba92dd3e2f796184
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-12-19 13:29:37 -08:00
FMorschel ae81c0fc05 [DAS] Fixes import with prefix to work with annotations
Fixes: https://github.com/dart-lang/sdk/issues/62259
Change-Id: I0dc38fbf16a3f88a4380c94d856c89fc5d8130df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468903
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-12-19 13:29:18 -08:00
Konstantin Shcheglov 23a903e9ae DeCo. Build extension type primary constructors like regular ones.
Previously, the AST builder enforced strict constraints on extension
type primary constructors during parsing, often discarding or
transforming invalid parameters (e.g., multiple, optional, or named
parameters) to force a valid representation field structure. This
limited recovery and resulted in inaccurate element models for invalid
code.

This change updates the AST builder to parse and build elements for the
primary constructor's formal parameters exactly as written. The
validation logic ensuring a single, positional representation field has
been moved to `ErrorVerifier`.

To maintain the invariant that an extension type has a representation, a
synthetic "recovery" representation field is now added to the element
model if the parsed parameters do not provide a valid one.

Bug: https://github.com/dart-lang/sdk/issues/61701
Change-Id: I37b7eaf2c085db6317b2c2b0bf35ff31423f9738
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465180
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-12-19 07:38:31 -08:00
Brian Wilkerson 7ed0d8d7b2 Fix a crash in the outline computer
This isn't the right implementation, but it no longer crashes when
experimenting with the primary_constructor feature.

While I don't expect this to impact users, it makes it easier for us to
play with the feature while developing the tooling for it.

Change-Id: I317eb03bfd4057adb39dd4352e43e41fdd28bd7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469101
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-12-18 13:01:59 -08:00
Sam Rawlins 971aa0b12a meta: Annotate visibleForOverriding and visibleForTesting with TargetKinds
In the analyzer, remove our custom warning for `visibleForOverriding`,
`invalid_visible_for_overriding_annotation` (replaced by the existing
`invalid_annotation_target` warning). The tests for that warning are
mostly covered by the existing `invalid_annotation_target` tests, but
I added a few to fill some gaps.

Work towards https://github.com/dart-lang/sdk/issues/62253

Change-Id: Ie960db6ebe007afde787f68e4b6b9f20a1835639
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468702
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-12-18 12:05:43 -08:00
Sam Rawlins f26bf0012d analyzer: Report unused fields with origin in a primary constructor
Work towards https://github.com/dart-lang/sdk/issues/62248

In this change, we exclude fields declared in a primary constructor
which is declared in an extension type. Since the representation field
is required, the corrective action is unclear. (I can't think of what
purpose an extension type would serve, if its representation field is
never referenced. But users are creative.)

Change-Id: I9556f5d28a16dc7114b30c77369281774bc7c2fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467924
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-12-18 11:26:20 -08:00
Keerti Parthasarathy 1f864a4633 [perf tesing]Add an option to write out a log with performance related data
This is mainly to exercise the performance test framework, for writing
a report for the test runs.

- adds a flag to specify a file
- logs context information and info from the message scheduler

Started with just these two as an example as I was not sure what performance data we do want to record.

Change-Id: I3e5ff4b77c62d36e47ba7bac8f656b19ba19c457
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2025-12-18 07:35:49 -08:00
FMorschel 850a760078 [DAS] Fixes dot-shorthand completion for annotations
Fixes: https://github.com/dart-lang/sdk/issues/62260
Change-Id: I3439237fd02c66600908190caeb07e1b0c4bfa7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-12-17 08:59:27 -08:00
Jake Macdonald db06bb7f13 Initialize SDK and regular projects on creation
Runs either `dart pub get` or `gclient sync`, based on project type.

For the SDK, copies the .gclient and .gclient_entries files as well
into the parent dir.

Also adds a `--timeout` argument, controls how long to wait for analyzer messages.

Change-Id: Id2c28e6d0251e94914bb0650be104c1f90a66651
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2025-12-16 12:30:25 -08:00
FMorschel 275581bca1 [DAS] Fixes completion for switch expression pattern after when
Fixes: https://github.com/dart-lang/sdk/issues/62210
Change-Id: I42a3d6f3f93a8ecc8f4b866d89119a6cc49bd3e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467160
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2025-12-16 09:07:37 -08:00
Brian Wilkerson 4dd879a477 Stop suggesting final in parameter lists
This stops completion from suggesting `final` outisde a primary
constructor's parameter list when the feature is enabled. When the
feature is not enabled, it won't be suggested anywhere. I did that
because in the same release this CL is for we'll produce a warning if
`final` is used, and it seems unhelpful to suggest adding code that will
have a diagnostic associated with it.

Change-Id: I2f8ad2d92ea0641e2212c89d01aa23921b39b3e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468401
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-12-16 07:17:29 -08:00