Commit Graph

107806 Commits

Author SHA1 Message Date
Devon Carew e2d6df2a74 [deps] rev ai, ecosystem, i18n, protobuf, test, tools, webdev
Revisions updated by `dart tools/rev_sdk_deps.dart`.

ai (https://github.com/dart-lang/ai/compare/6a71aeb..1d9d60c):
  1d9d60c  2025-06-05  Jacob MacDonald  handle relative paths under roots without trailing slashes (dart-lang/ai#152)

ecosystem (https://github.com/dart-lang/ecosystem/compare/8cebaf0..64aac3a):
  64aac3a  2025-06-03  Daco Harkes  [health] Bump dart_apitool (dart-lang/ecosystem#360)

i18n (https://github.com/dart-lang/i18n/compare/e44af54..43214dd):
  43214dde  2025-06-04  Moritz  Upgrade to new native_assets (dart-lang/i18n#964)

protobuf (https://github.com/dart-lang/protobuf/compare/c69077d..32d53da):
  32d53da  2025-06-05  Devon Carew  Refactor the test goldens so they have standard file name extensions (dart-lang/protobuf#1014)

test (https://github.com/dart-lang/test/compare/e2ddae9..0793a2b):
  0793a2b3  2025-06-05  Agam Agarwal  Add isSorted and related matchers (dart-lang/test#2490)

tools (https://github.com/dart-lang/tools/compare/04c6849..e84cbd9):
  e84cbd9e  2025-06-04  Christophe Coevoet  [source_span] Add a test covering the highlighting of non-contiguous spans (dart-lang/tools#1666)
  700a3c4d  2025-06-04  Liam Appelbe  [coverage] Fix remaining ~0.1% flakiness (dart-lang/tools#2102)

webdev (https://github.com/dart-lang/webdev/compare/64492b2..55941b0):
  55941b0c  2025-06-05  Kevin Moore  [dwds] DRY up MD5/etag logic (dart-lang/webdev#2625)
  ab7c4d68  2025-06-05  dependabot[bot]  Bump the github-actions group across 1 directory with 3 updates (dart-lang/webdev#2593)
  f149e43f  2025-06-05  Nate Biggs  Update e2e_test expectation to look for more consistent message. (dart-lang/webdev#2630)
  80b1686b  2025-06-03  Nicholas Shahan  Fix e2e_test to work with current DDC output (dart-lang/webdev#2626)

Change-Id: I4802d7c4a7e39ba238f2f4ce0748dfa6dba9d8c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433240
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2025-06-05 12:58:53 -07:00
Brian Wilkerson edce10b761 Add an assist to convert from a field formal parameter to a normal parameter
Fixes https://github.com/dart-lang/sdk/issues/60852

Change-Id: Iffc674e61b4df16e80ca71cfd18e12c548770b54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433220
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 12:33:34 -07:00
FMorschel 9d6c5d40d0 [DAS] Fixes "Go to declaration" for undefined new constructor
Fixes: https://github.com/dart-lang/sdk/issues/60773
Change-Id: I7ee7cec371fbf0d0f9de1a4fe2b946929ba80d61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432741
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-06-05 12:08:44 -07:00
Brian Wilkerson 45722db629 Add documentation for dot shorthand diagnostics
Please let me know if there are other diagnostics that I missed.

Change-Id: I87d29f62bcd1dad519c34212a2aa41d4422f1002
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431949
Reviewed-by: Kallen Tu <kallentu@google.com>
Reviewed-by: Amanda Fitch <afitch@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 10:58:09 -07:00
Danny Tuppeny 9df000075a [analysis_server] Exclude blocks/switch cases from Inline Values unless execution is within them
This prevents inline values showing up alongside code that didn't execute in conditional blocks. It does also mean they don't know up in conditional blocks that _did_ execute one execution has fallen out of them, but I believe this is the best we can do with the current LSP APIs (unless we try to track execution across requests, but that would probably be complete and not entirely reliable).

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

Change-Id: Ia1cf2437b76844ff0a6aeeb958d769c9523dc5dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433200
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 10:53:12 -07:00
Nicholas Shahan 60d418034a [ddc] Bump language version to 3.8
* Reformat pkg/dev_compiler.
* Re-flow some comments to keep them within 80 characters.

Change-Id: I0849ce113ecf3dce4a2b4405c2b09a17dee4df76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433081
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2025-06-05 10:40:57 -07:00
Nicholas Shahan 6697075645 [ddc] Fix spelling typos
Change-Id: Iafcf14be1fd3032381b4ced2610230538100ce52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433080
Reviewed-by: Mark Zhou <markzipan@google.com>
2025-06-05 10:40:57 -07:00
Sam Rawlins e76fcdad1a analyzer: Remove TODO that is DONE
Change-Id: I15a85d31b797d99d68c94b3c0fe433c18d9effbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432905
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-05 09:43:32 -07:00
Danny Tuppeny b8daa53fef [analysis_server] Don't rebuild contexts on deletion of an analysis root
This is a partial revert of ca9523058e (it removes the behaviour change and the test that verifies this, but leaves two additional tests that were added relating to roots that are created later).

If we rebuild contexts when a root is deleted, we may get stuck in a loop because we will again try to recreate the same (deleted) root, and then the watcher will close in a way that looks like a deleted folder, and we will repeat.

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

Change-Id: I10289160b341d273e8e409184a1c013c7fb9439d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433140
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 09:24:41 -07:00
Nate Biggs 26e9c8201a [dart2js] Don't emit deferred loading logs in part files when flag is disabled.
Change-Id: I70a3a3a3c7bd56d8fd994e766f0ab2ab8c1f9ec4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432820
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-06-05 09:17:11 -07:00
Derek Xu c9c8929099 [package:vm_service] Add kTimerSignificantlyOverdue field to EventKind
I overlooked making this additon earlier. This CL also prepares
`package:vm_service 15.0.2` to be published.

TEST=CI

Change-Id: I4d28d87c027d27c4e532e5608f57b62eaa290e44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433082
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-06-05 07:34:51 -07:00
Danny Tuppeny e891cac045 [dds/dap] Handle some additional kinds of errors when the VM Service connection shuts down
This handles an RPC Error -32000 with text "Service connection disposed" as reported in https://github.com/dart-lang/sdk/issues/60851. It extracts some of this logic into an extension on RPCError to simplify checking in multiple places.

Unfortunately I can't reproduce the specific conditions that produce this error in a test (it probably requires terminated the VM Service at just the right time during startup or an isolate starting?).

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

Change-Id: Iae945f60290766164d04b91d851fbb8b58f178c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432944
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-06-05 07:26:16 -07:00
Jake Macdonald bf9acedc73 Adds a new helper resolveTestRelativePath for resolving paths relative to the test dir, which works using the package config instead of Platform.script. This allows it to work via dart test as well as the test runner, or when manually invoked.
Replaced usages of Platform.script.resolve with this utility.

Change-Id: I904d281934c3eb42516e891f27a8f3dbe714e7f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432740
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-06-05 07:23:15 -07:00
Kenzie Davisson 495a2bb694 Update to latest DevTools hash
Change-Id: I3ecb7e661b606907186c0a81b16eecefe4d63a4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432803
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2025-06-05 04:13:34 -07:00
Sam Rawlins b2beba242d analyzer: Convert callers of InheritanceManager3 to use InterfaceElement API
This includes all callers in analysis_server and analyzer_plugin. And
callers of `getOverridden4`.

Change-Id: Ia744f6c7260b445c6b1e02d3cf5515aaa9c7feeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432962
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-04 16:30:22 -07:00
Sam Rawlins c4c3a72bd4 analyzer: Move error_supporession_test.dart
Work towards https://github.com/dart-lang/sdk/issues/60635

Also rename the test methods to use camelCase and to read more like
sentences.

Change-Id: If4ef85aeeefc5f1364ffbcba2e73df36981fc951
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432961
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-04 16:06:14 -07:00
Brian Wilkerson 1a7617e015 Improve the message for non_exhaustive_switch diagnostics
Fixes https://github.com/dart-lang/sdk/issues/60690

Change-Id: I1431d646a53c39b738369493b6a234df440dc2f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-04 15:17:19 -07:00
Ryan Macnak bc17496b00 [vm] Fix Google3 ClangTidy warnings.
TEST=presubmit
Change-Id: Ifa4e77cc4548729526a90683ee163c68517e87ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433001
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-04 15:14:15 -07:00
Brian Wilkerson 0404c6cd08 Add some message scheduler data to the collected report
Change-Id: I086b741a90955a2753efbabdf1c3cb321de98ee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432903
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-06-04 15:08:20 -07:00
Danny Tuppeny 8d36178a43 [analysis_server] Move support for locking requests to the scheduler
This removes the original `lockRequestsWhile` functionality of the LSP server which worked by pausing reading from stdin to instead pause the processing of messages in the scheduler.

Change-Id: I737e977adee11fe6fc70f44185cfaa22c22805da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-04 15:06:12 -07:00
Ryan Macnak 87575b2578 [vm] Remove --trace_optimized_ic_calls.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54377
Change-Id: Ibd3b2d05de241dffe3fa99b5d3a54cd20e0c4fdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433041
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-06-04 13:21:22 -07:00
Sam Rawlins 47f7c4fb87 analyzer: expose canBeConst and computeConstantValue as public API
Work towards https://github.com/dart-lang/sdk/issues/50986

These utilities are used by a handful of lint rules, and the analysis
server, which makes me think they could be offered as public API.

Change-Id: I12415c2b86ca6fb96b03def4a304da73c6fb4cae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430300
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-04 11:02:17 -07:00
Sam Rawlins 508c35b6f0 linter: unawaited_futures: narrow the reported range, matching discarded_futures
Change-Id: Id8a361a352e409df0a8c9cc9fa73a9f7b5e52c3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431365
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-04 09:26:31 -07:00
Kenzie Davisson 0010cc416f Use constants instead of raw strings throughout package:dtd
Change-Id: Ie4b0dfb115a820fb3f0741ce193c70f6b7d560cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432725
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2025-06-04 08:52:33 -07:00
Danny Tuppeny b1751e6871 [analysis_server] Update some tests to not required useLineEndingsForPlatform=false
Change-Id: I5eafe194465e20942ebea6989a75679d1a9bb866
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432980
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-04 08:45:59 -07:00
Danny Tuppeny 9756ab92db [dds/dap] Include paging data for variables returned as top-level results to evaluateRequest
This reuses the existing code for child variables for building responses to `evaluate` so that we compute lengths for paging data. We have to copy them over from the variable to the EvaluateResponse because these are two unrelated types that happen to have the same fields for this data.

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

Change-Id: I7ca4c522cdb27ce8dce3f7c3a78189417eb93bf1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432941
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-06-04 08:35:03 -07:00
Keerti Parthasarathy 25b99786d1 [Completion] Fix for adding duplicate keywords like 'dynamic' when in a declaration.
Change-Id: If8e35edd5ee136b0d272f1ea43a705cf04540bbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432821
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-04 08:31:37 -07:00
Sam Rawlins 7253f6198d infra: combine all three "analyze flutter" scripts.
The previous three scripts had some redundancies:

* Both the flutter/flutter analyzing script and the flutter/packages
  analyzing script checked out flutter/flutter. Combining them saves
  several minutes.
* The script that analyzed flutter/engine was pointing to the old
  engine repo, which was archived months ago. In pointing the script
  to the new sources at flutter/flutter, this would introduce another
  instance of cloning flutter/flutter. Combining this with the other
  scripts saves several minutes.

The only other little changes to the code are the introduction of
more echo commands, more `pushd`/`popd` vs `cd`, and isolating the
three tasks into functions for readability.

Change-Id: I08414d824c25075a8810b1aa0cc299c64328abbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432881
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-06-04 08:20:04 -07:00
Daco Harkes 47cc2606f4 [ffi/test] Address lints
Change-Id: I3b13731935c8520b8ca17ee45d967499fccdcbe9
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432940
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-06-04 07:53:51 -07:00
Danny Tuppeny 0f161e3ebe [analysis_server] Allow documentation preferences to be different between completion/hovers
For https://github.com/Dart-Code/Dart-Code/issues/4729 we added a configuration setting to let you control how much documentation was included in responses. The motivation here was to reduce the completion payload sizes when running in remote workspaces (Dart-Code would adjust the default setting if not explicitly set by the user based on the workspace kind).

However in hindsight, forcing no docs on Hovers just because we didn't want them in Completion requests was a bad choice, because these are individual requests where the payload size is less important and seeing the docs is useful.

So this alters the setting to accept a `Map` to allow you to have different preferences for each request that returns docs. Dart-Code will be updated to adjust the defaults accordingly (after this lands) so that Hover/SignatureHelp can default to `"full"` even in remote workspaces.

Work towards https://github.com/Dart-Code/Dart-Code/issues/5499

Change-Id: Ib64f762a0559c7afc7653fad9749fc208beee8b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431280
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-04 07:51:45 -07:00
Chloe Stefantsova c542a1e82f [model] Remove support for subtype checks ignoring nullability
Change-Id: I4a43e09094d79c7b5e59eb03cbe7eb676808a5f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426121
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-06-04 06:52:57 -07:00
Paul Berry eec56c088e [flow analysis] Mark false branches of trivial is tests unreachable.
When an `is` test is trivially satisfied (i.e. `expr is T`, when the
static type of `expr` is a subtype of `T`), the `is` test is
guaranteed by soundness to evaluate to `true`, so any code path that
follows from the `is` test evaluating to `false` is unreachable.

This reasoning wasn't valid prior to sound null safety, because in
mixed mode programs, it was possible for an expression to evaluate to
`null` even if its static type wasn't nullable, and hence `expr is T`
might evaluate to `false` even if the static type of `expr` was a
subtype of `T`. So this change is gated on the `sound-flow-analysis`
language flag (which is enabled in Dart 3.9).

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

Change-Id: I66a65580b738162f23b6fb468b71fcac66bfbb95
Bug: https://github.com/dart-lang/sdk/issues/60718
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431740
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-04 05:17:21 -07:00
Johnni Winther 27952c5368 [cfe] Remove ConstructorDeclarationBuilder
This interface is no longer needed since SourceConstructorBuilder is the
only implementation.

Change-Id: Ic6426d4c0dbc3820e460a1e4fdc69f323c763885
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432942
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-06-04 04:21:24 -07:00
Chloe Stefantsova 4e9d539c0d [cfe] Mark super initializing parameters erroneous due initializers
Change-Id: I7cf43027a9058f64f41331c9f0b9f9529651d48d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432341
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2025-06-04 01:18:21 -07:00
Daco Harkes eee91d78c3 [infra] gitignore gclient files
When using

```
solutions = [
  {
    "name": ".",
    "url": "https://dart.googlesource.com/sdk.git",
    "deps_file": "DEPS",
    "managed": False,
    "custom_deps": {},
    "custom_vars": {
      "dart_root": ".",
    },
  },
]
```

the .gclient and .cipd files end up in the root of the SDK.
So, gitignore them.

Bug: https://github.com/dart-lang/sdk/issues/60848
Change-Id: I41f26b74838977d7f9fe655def8bd0c85bef7ee2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432840
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Hossein Yousefi <yousefi@google.com>
2025-06-04 01:15:10 -07:00
Ryan Macnak caf311f681 [vm, compiler] Fix incorrect write barrier eliminiation after catch control flow.
Write barrier elimination applies when there is no potential Dart call between a StoreFieldInstr and an AllocateObjectInstr. But the control flow between all potentially throwing instructions in a try block and the corresponding catch block is not explicitly repreresented in the flow graph, so the writer barrier elimination pass needs to handle catch entries specially.

TEST=vm/dart/write_barrier_catch_entry_test
Bug: https://github.com/dart-lang/sdk/issues/60836
Change-Id: I96d5999433320e87da095f85e4a7438bcf5e134f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432880
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-03 17:22:00 -07:00
Paul Berry b0e488fcb2 [flow analysis] In tests, stop rewriting ordinary variable declarations.
During the implementation of flow analysis for patterns, I added a
hack to the flow analysis tests so that all variable declarations were
desugared into the equivalent pattern variable declaration. This had
the advantage of getting some extra testing "for free" during early
development of the patterns feature, but it had a few disadvantages:

- It the caused the shared flow analysis and type inference tests to
  stop exercising flow analysis code paths for ordinary variable
  declarations.

- It forced the testing logic to "support" pattern variable
  declarations that are late or lack an initializer; these are things
  that regular Dart doesn't support, and they made the implementation
  of `PatternVariableDeclaration.visit` much more complicated than it
  needed to be.

The language team is currently contemplating some changes to how
promotions work in ordinary variable declarations and pattern variable
declarations (see, for example,
https://github.com/dart-lang/language/issues/4347#issuecomment-2861859329). So
in order to be able to experiment with these possibilities, I want to
get rid of this hack.

This CL adds a `VariableDeclaration` class, to represent ordinary
variable declarations, and modifies the `declare` function (which is
used by tests for creating an ordinary variable declaration) so that
it creates a `VariableDeclaration`, rather than rewriting it into a
`PatternVariableDeclaration` containing a `VariablePattern`. It
removes "support" for testing pattern variable declarations that are
late or lack an initializer, simplifying
`PatternVariableDeclaration.visit`.

A few test cases in `type_inference_test.dart` were checking the
generated IR for ordinary variable declarations, verifying that it was
properly desugared into a pattern variable declaration; these
expectations have accordingly changed to no longer expect desugaring.

There is no functional change to the compiler or analyzer
toolchain. These changes only affect tests in
`pkg/_fe_analyzer_shared/test`.

Change-Id: I90f074cd6e7a6ed5ed11afadeadb6131ce1d282f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432122
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-03 17:10:44 -07:00
Ryan Macnak cfccc2a2a8 [infra] Add arm64 back to gcc testing.
This was broken during Jammy but this builder now runs on Noble.

Cq-Include-Trybots: luci.dart.try:vm-gcc-linux-try
Change-Id: I39e4a1f924620723d36dad79383637fe5b62add7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432760
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-03 16:06:00 -07:00
Paul Berry 69428c35cf [flow analysis] Rename code for testing pattern variable declarations.
The following renames are performed:

- The class `Declare` (which is the "mini-AST" representation of a
  pattern variable declaration), is renamed to
  `PatternVariableDeclaration`.

- The top level function `match` (which is used in tests to construct
  a "mini-AST" representation of a pattern variable declaration), is
  renamed to `patternVariableDeclaration`.

The new names should help avoid confusion in a follow-up CL I intend
to create, which will introduce a new `VariableDeclaration` class to
represent ordinary variable declarations.

There is no functional change. These renames only affect tests in
`pkg/_fe_analyzer_shared`.

Change-Id: Ic6b6f75cbb312180273a08f2c3926f83da254bc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432120
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-06-03 15:21:20 -07:00
Konstantin Shcheglov 8af392c657 Elements. Print FieldElementImpl references in text expectations.
Change-Id: I1f4aefbf0e1f24a5f7ffe1a7e44b83e78f186b14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432822
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-06-03 14:45:08 -07:00
Paul Berry 9602464304 [flow analysis] Don't clear types of interest on full demotion.
Previously, when assiging to a local variable that was promoted, if
the newly assigned value was not compatible with any of the promotions
(i.e., the variable was fully demoted back to its declared type), then
the set of types of interest was cleared.

This behavior was not documented anywhere in the spec, and it seems
oddly inconsistent to me; as far as I can tell, flow analysis doesn't
clear types of interest in any other circumstances. I've looked
through git history as well as my personal notes, and I've been unable
to find any justification for this behavior. So, with the agreement of
the language team, I'm removing it when sound-flow-analysis is
enabled.

Fixes https://github.com/dart-lang/language/issues/4380.

Bug: https://github.com/dart-lang/language/issues/4380
Change-Id: Ic1ca80a61e21482e659afa8796b08fce707db3c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429227
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-06-03 14:19:53 -07:00
Sam Rawlins cb61cfa8fe linter: Use RuleContext over the deprecated alias, LinterContext
Change-Id: I3df38b96a0cb7756a9dbfbffc80d50c4c73337ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432723
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-03 14:11:02 -07:00
Konstantin Shcheglov 147ba501d7 Elements. Print ConstructorElementImpl references in text expectations.
Change-Id: I090dc6f9471dae969480caeba0204401dbf280e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432724
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-03 14:08:39 -07:00
Konstantin Shcheglov d116d50416 Elements. Add reference to FieldElementImpl2, write it.
Change-Id: Ia5f4c01aa46571c0a835f7e6408cd1af17fd75e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432781
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-06-03 13:26:29 -07:00
pq d150bcb97c [das] legacy server support for analytics checking
Fixes: https://github.com/dart-lang/sdk/issues/60853

Change-Id: I3a14c209482b47dc8228c678793e23cf91295fd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432780
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-03 12:56:12 -07:00
Nate Biggs f7068a415e [ddc] Relax conditions on allowed defineLibrary calls during hot reload.
The current conditions make it so that every library transitively reachable from a reload target (and therefore included in the DDC output) must be known in the client when `dartDevEmbedder.hotReload` is called.

While this is the case for pages running with DWDS, it's an unnecessary constraint. Some users may only care about reloading a specific subset of known libraries. As is the case in dart-pad when we only need to reload the main library as we know this is the only code that can have changed.

Any new libraries must also registered and initialized as this is new code not yet in the page. This would happen if a new import was added to the code.

Change-Id: I164f59a6931fd809867716c164cb467880806f8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432440
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-06-03 12:02:03 -07:00
Sam Rawlins a9ecdf3dc8 linter: Remove more private exports
These exports make it too easy to accidentally rely on private
analyzer impl. Where it is necessary, calling out the individual
imports helps to understand where private impl is used.

Change-Id: I2968610d8285812087b3f716159003d12561eb30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-03 11:59:39 -07:00
Sam Rawlins 31f8f4b522 analyzer: Make various AnalysisRule classes and their dependencies public
This is a big CL; no code is really "changed." We basically move 3
components into the public API, which can all be reviewed concisely
in the `api.txt` file.

* The AnalysisRule classes: `AbstractAnalysisRule` (which is good to
  make public as a lot of the public API is specified and documented
  here), `AnalysisRule`, `MultiAnalysisRule`.
* The Pubspec classes, available for linting pubspec files:
  `PubspecDependency`, `PubspecDependencyList`, `PubspecEntry`,
  `PubspecEnvironment`, `PubspecGitRepo`, `PubspecHost`, `PubspecNode`,
  `PubspecNodeList`, `PubspecVisitor`.
* The `RuleVisitorRegistry` class. This class is needed by analysis
  rule authors, and is part of the public API of AnalysisRule.

Change-Id: Ib1803180de9469f4ff39cf1778f96787f5f74b14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432363
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-03 11:09:32 -07:00
Ryan Macnak 13779dea53 [vm] Give the native call wrappers C linkage.
This avoids undefined behavior.

Cf. 18aa7d3678

TEST=ci
Change-Id: I2dd82517177ee812b3cd3ae4b1c748de129ec665
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432720
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-03 10:36:23 -07:00
Tess Strickland 5c1f5cadb2 [build] Re-add targets used by Flutter.
TEST=ci

Cq-Include-Trybots: luci.dart.try:flutter-linux-try
Change-Id: Ifd8412fdc74095ffb027e80c8217ce1b5804a607
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432702
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
2025-06-03 09:46:43 -07:00