Commit Graph

110793 Commits

Author SHA1 Message Date
Ryan Macnak 7bb5e4c192 [build] Fix Windows ASAN build to actually use ASAN.
Bug: https://github.com/dart-lang/sdk/issues/62263
Change-Id: I77a44aeff0a0685730ff3e5c897e338ddc5561a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464781
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-12-17 14:08:00 -08:00
DEPS Autoroller cb938a46ae Roll BoringSSL from 53844eb8bb2a to 875810f3c416 (2 revisions)
https://boringssl.googlesource.com/boringssl.git/+log/53844eb8bb2a..875810f3c416

2025-12-15 rpolzer@google.com EVP_AEAD: implement sealv/openv for the TLS ciphers.
2025-12-15 rpolzer@google.com EVP_AEAD: implement sealv/openv for ChaCha20-Poly1305.

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/boringssl-dart-sdk
Please CC dart-engprod@google.com,dart-vm-gardener@grotations.appspotmail.com,dart-vm-team@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in BoringSSL: https://crbug.com/boringssl/new
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Tbr: dart-vm-gardener@grotations.appspotmail.com
Change-Id: I157a7e02a7dd136f142720b796febeb31bc45447
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468420
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-12-17 13:48:01 -08:00
Ryan Macnak 8b4bd49b6b [gardening] Fix gcc build.
TEST=build
Change-Id: I03574459c178f31f15f3a9200358cea4bde75573
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468901
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-12-17 13:18:10 -08:00
Paul Berry 63a719a488 [messages] Fix use_literate_api_in_analyzer.dart after uniqueName changes.
In https://dart-review.googlesource.com/c/sdk/+/468080, the private
implementation of the `DiagnosticCode` class was changed so that the
unique name of the error code is now stored in a field called
`_uniqueName`. (Previously it was stored in a field called
`uniqueName`. This inadvertently broke the
`use_literate_api_in_analyzer.dart` script. The fix is simple: change
`use_literate_api_in_analyzer.dart` to access the unique name using
the `_uniqueName` field.

Change-Id: I6a6a6964088b30506e52c1e1ae47c75293f5910c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468902
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-12-17 12:52:31 -08:00
Ben Konyi 4cbf367b94 [ dart2bytecode ] Skip more tests that depend on dart:mirrors
Change-Id: I3dadc31c7cb2ba351ec797d8a851d82bf5bab232
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468920
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2025-12-17 11:54:43 -08:00
Paul Berry 2f739bd2e8 [analyzer] Add ClassMemberImpl.augmentKeyword.
All classes derived from `ClassMemberImpl` already had an
implementation of `augmentKeyword` except for
`PrimaryConstructorBodyImpl` (which was added as part of this CL).

In a follow-up CL, this will be used as part of a rewrite of
`MemberDuplicateDefinitionVerifier`, to allow members marked `augment`
to be excluded from duplicate checking.

Change-Id: I6a6a6964b8e41e3e5fde3e17428204d1e0898bbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468882
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-12-17 11:32:39 -08:00
Paul Berry 1636ed2b71 [analyzer] Move enum name error logic out of MemberDuplicateDefinitionVerifier.
Moves the logic for reporting `diag.enumConstantSameNameAsEnclosing`
and `diag.enumWithNameValues` out of
`MemberDuplicateDefinitionVerifier` and into `ErrorVerifier`. The
logic for detecting these diagnostics doesn't really make sense to be
part of `MemberDuplicateDefinitionVerifier`, because
`MemberDuplicateDefinitionVerifier` is concerned with detecting when a
class member has the same name as a previous member, whereas
`diag.enumConstantSameNameAsEnclosing` and `diag.enumWithNameValues`
are concerned with detecting when a class member has the same as the
class itself.

In a follow-up CL I intend to do a pretty substantial rewrite of
`MemberDuplicateDefinitionVerifier`. Moving this unrelated logic out
of `MemberDuplicateDefinitionVerifier` will make that rewrite more
straightforward.

Change-Id: I6a6a69645b1b3e5c4524d6de5816cb687b14994b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468841
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-12-17 11:24:00 -08:00
Paul Berry 864b9c0352 [analyzer] Move MemberDuplicateDefinitionVerifier to its own file.
In a follow-up CL I intend to do a pretty substantial rewrite of
`MemberDuplicateDefinitionVerifier`, but I plan to leave the rest of
`duplicate_definition_verifier.dart` mostly unchanged. Moving the code
that's changing to its own file should make the rewrite easier.

Change-Id: I6a6a69644f9cf661f0add8420f52bc659c2964e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468840
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-12-17 11:09:39 -08:00
Paul Berry 02589dd669 [analyzer] Remove DuplicateDefinitionVerifier.context field.
It is not used; the `DuplicationDefinitionContext` is passed directly
from `LibraryVerificationContext` to
`MemberDuplicateDefinitionVerifier` by the static method
`MemberDuplicateDefinitionVerifier.checkLibrary`.

Change-Id: I6a6a6964b10e895eac4bf70706ab5b7b793886f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468560
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-12-17 11:07:15 -08:00
Paul Berry a3f899fcba [analyzer] Seal InstanceElementImpl and InterfaceElementImpl.
Changes the classes `InstanceElementImpl` and `InterfaceElementImpl`
to sealed classes. This helps avoid mistakes when switching on
variables of these types.

In a follow-up CL I intend to do a pretty substantial rewrite of
`MemberDuplicateDefinitionVerifier`. Making these classes sealed will
allow that rewrite to use `switch` expressions to decide which
diagnostic to report.

Change-Id: I6a6a6964c8e7d8c1a4478f45ff33fff4d77ea4db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468860
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-12-17 10:41:12 -08:00
Ben Konyi b5e60be49d [ DDC / CFE ] Add support for allowing imports of unsupported libraries
This change adds support for allowing for imports of unsupported
platform-specific libraries when the
`--include-unsupported-platform-library-stubs` flag is provided to the
CFE.

This flag sets the `includeUnsupportedPlatformLibraryStubs` property in
`TargetFlags`, which `Target`s can use to conditionally return different
`DartLibrarySupport` objects with different supported/unsupported
library sets.

A `checkForUnsupportedDartColonImports` function has been added to
`Target` that uses the value of `dartLibrarySupport` to determine if
there's any unsupported library imports. This function is called after
the various transformation operations provided by the `Target`
implementation, meaning the import of an unsupported library specified
in `dartLibrarySupport` will now result in a compilation error (this
includes `dart:mirrors` imports for VM targets when mirrors are
disabled, which was previously handled by the VM itself).

Related to https://github.com/dart-lang/sdk/issues/62125

TEST=Tests added / modified

Change-Id: Ife819b2e1a6d28f67d80aab6701cd23a1724aa4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465760
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-12-17 09:30:38 -08:00
Ben Konyi df3e4046b4 [ SDK ] Add js_dev_runtime stubs for dart:ffi
This will allow for developer tooling to still compile applications with
`dart:ffi` imports for web targets.

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

CoreLibraryReviewExempt: Not changing implementations, just adding stubs
Change-Id: I7347dc81c8bffe0becaf4b1d002d6aca2de60244
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464960
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-12-17 09:26:12 -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
Paul Berry 2c142686c4 [messages] deprecate diagnosticCode.name and diagnosticCode.uniqueName.
Deprecates `DiagnosticCode.name` and
`diagnosticCode.uniqueName`. Clients should use
`DiagnosticCode.lowerCaseName` and
`DiagnosticCode.lowerCaseUniqueName` instead. This will ensure that
clients will compare diagnostic codes in case-insensitive fashion, as
the analyzer itself does.

In a future breaking change release of the analyzer, I will remove the
deprecated getters.

Change-Id: I6a6a69642f2d386546406d4af734808afec13e5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-12-17 08:33:11 -08:00
Alexander Markov 7c76e3c394 Adjust OWNERS for pkg/native_compiler/lib/runtime/vm_offsets.g.dart
VM team members often need to update auto-generated VM offsets, so
adjust the OWNERS to simplify that.

Change-Id: I1a15652673a336ff2d20f0ca63c43b277dd5ebe9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468402
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-12-17 08:30:16 -08:00
Ryan Macnak 674a42d292 [vm, compiler] Check for ASAN and MSAN violations from Dart generated code.
Inform ASAN and MSAN about reads and writes through FFI pointers or external typed data. Previously we only informed MSAN about writes, which was enough to prevent false positives in foreign code, but gave false negatives for Dart code. This mostly uses the same machinery used for TSAN, and replaces some of the existing MSAN unpoison calls.

Also fixes some marshalling of compounds by value that generate loads extending past the end of the compound.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/62221
Change-Id: Ia3573edb5a0aec32b6a57035a63e8f323a655ecc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467401
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-12-17 07:37:29 -08:00
Paul Berry 2e0875bada [messages] Use lowerCaseName in test_runner.
Change the `test_runner` package's use of `DiagnosticCode.name` to
`DiagnosticCode.lowerCaseName`. There is no functional change since
all diagnostic codes generated by the analyzer are already in lower
case.

This helps pave the way for eventually deprecating and removing
`DiagnosticCode.name`, which will help ensure that analyzer clients
treat diagnostic codes in a case-insensitive fashion.

Change-Id: I6a6a69644898dff67a1f53dbe8c8a8cb757d2c96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468121
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2025-12-17 07:20:17 -08:00
David Morgan bd55135246 Bump tools to da3c459288410c003a84dbf28564a9bf7ca8091e
Bump core to cbb485437c61d37753bcc98818beca54d5b38f69

Changes:
```
 https://dart.googlesource.com/tools.git/+/da3c4592 Prepare `code_builder` 4.11.1 for `fixnum` 1.2.0. (2281)
 https://dart.googlesource.com/tools.git/+/e7015c50 [analytics] add `ide_event` (2282)
 https://dart.googlesource.com/tools.git/+/c745428d Add wasm_dry_run_package event to track public package names from wasm dry run findings. (2279)
 https://dart.googlesource.com/tools.git/+/db90378b Release watcher 1.2.0. (2276)
 https://dart.googlesource.com/tools.git/+/9b23f6a8 Document end to end testing. (2275)
 https://dart.googlesource.com/tools.git/+/31045f0c Fix flaky test on Windows. (2278)
 https://dart.googlesource.com/core.git/+/cbb48543 Fix `Int64.toRadixStringUnsigned` extra leading digits (926)
 https://dart.googlesource.com/core.git/+/41a9e016 Add missing Int64.toDebugString for the native class (927)
```
Change-Id: If5c25eb4b82c8fbc7bcd987a4359b1f028cdbff6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468760
Commit-Queue: Morgan :) <davidmorgan@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2025-12-17 03:34:20 -08:00
Slava Egorov 96eece84bd [vm/io] Avoid %ls in SetOsErrorMessage
This format specifier does not perform a wide char to utf8 conversion
but rather a locale dependent wide char to multibyte conversion 
(essentially wcstombs), which is not what this function is expecting
to do (it is expected to return utf8 encoded error message). 

Issue https://github.com/dart-lang/sdk/issues/62252

TEST=not tested, speculative fix

Change-Id: Icd5ddbf9969dbd4acd2f7f48626ce0bd6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468800
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-12-17 03:20:11 -08:00
Alexander Markov c768f07c7d [vm/corelib] Remove obsolete null checks from dart:io
CoreLibraryReviewExempt: no API changes, only cleanup in dart:io
Issue: https://github.com/dart-lang/sdk/issues/40614
Change-Id: I9714e6b2b2b39540b5c0d9b87a21563f08721d25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468641
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-12-16 16:00:17 -08:00
Alexander Markov ecf78ee1ae [vm/corelib] Cleanup obsolete null checks from the VM patch files
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/40614
Change-Id: I019f4e1fb54adaa585c234a6e806ac50213c6d80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468640
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-12-16 15:07:39 -08:00
Ryan Macnak 3fbd3ab070 [infra] Clean-up debugging temp file quarantine issue.
Change-Id: I8004c07ce0a60ac5134ac9c871cca2a9300b3583
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467381
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-12-16 13:34:00 -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
Ryan Macnak ee4ec6c84d [vm] Maintain W^X when mapping snapshots on Windows.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/62249
Change-Id: I4ee4e7420527907d20217916acbc4162d9a53800
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468441
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-12-16 09:22:52 -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
Nate Biggs 5458ba73e5 [dart2wasm] Improve module self-reference.
Use a (mutable) global rather than a function to get the externref to
the appropriate module for exported function wrappers. This way we don't
have to make a slow JS interop call to get the module.

Recovers regression in golem "FunctionToJs.Convert.*.*" benchmarks seen
from introducing these functions.

Change-Id: Ie05d803a3d9992dce3dda89e6ae5af83d3f34383
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468220
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-12-16 09:06:27 -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
Slava Egorov c058785219 [dartdev] Add info record-performance subcommand
This subcommand uses perf_witness recording functionality to record
performance timelines of all processes that opted into the recording.

Change-Id: I37fd9fc88e38853a77a105370e2020fc6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459745
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-12-16 06:19:25 -08:00
Chloe Stefantsova e1d5dc8c35 [cfe] Assign captured contexts to FunctionNodes
Part of https://github.com/dart-lang/sdk/issues/61572

Change-Id: Id6293f6300436d252a52e973cba6cd52cda48758
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468281
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-12-16 05:14:41 -08:00
Jens Johansen c56e94630e [vm] Allow Before/After GC to signal perf
This CL makes it possible for the Dart VM to start or stop `perf` while
doing GC, which gives a significantly more stable output.

Example usage:

Bash script that creates the correct file handles and calls dart under
`perf stat` based on the arguments given to the script:

```
DART=$1
shift
AOTSNAPSHOT=$1
shift

ctl_dir=/tmp/

ctl_fifo=${ctl_dir}perf_ctl.fifo
test -p ${ctl_fifo} && unlink ${ctl_fifo}
mkfifo ${ctl_fifo}
exec {ctl_fd}<>${ctl_fifo}

ctl_ack_fifo=${ctl_dir}perf_ctl_ack.fifo
test -p ${ctl_ack_fifo} && unlink ${ctl_ack_fifo}
mkfifo ${ctl_ack_fifo}
exec {ctl_fd_ack}<>${ctl_ack_fifo}

perf_ctl_fd=$ctl_fd perf_ctl_fd_ack=$ctl_fd_ack perf stat --delay=-1 --control fd:${ctl_fd},${ctl_fd_ack} -B -e "task-clock:u,context-switches:u,cpu-migrations:u,page-faults:u,cycles:u,instructions:u,branch-misses:u" $DART --perf_ctl_fd=${ctl_fd} --perf_ctl_fd_ack=${ctl_fd_ack} --perf_ctl_usage=1 --deterministic $AOTSNAPSHOT $@

exec {ctl_fd_ack}>&-
unlink ${ctl_ack_fifo}

exec {ctl_fd}>&-
unlink ${ctl_fifo}
```

This will start `perf stat` paused (which would require the run dart
aot-compiled script to start it when it wants to) and where the VM
pauses `perf` while doing GC.

In practise, looking at instruction counts reported by `perf stat`, I've
seen the difference between runs go from 2+ mio (and in some instances
23+ mio) to around 30,000 (!) on runs of the analyzer (tool
"stable_analysis").

TEST=manually

Change-Id: Iab955a5dd35e47f22c4f693ae50effc8ee633897
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468260
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2025-12-16 04:16:15 -08:00
Martin Kustermann d4531a418d [dart2wasm] Allow cross module function inlining
This reduces main wasm module a bit (<1%) as it avoids the main module
from having to define and export simple accessor (e.g. field accessor)
functions.

There's two scenarios to consider:

Deferred module calls function from main module
=> No issues

Main module calls function from deferred module
=> This call must have been preceded by a CheckLibraryIsLoaded
=> The wasm modules of the deferred import must have been loaded
=> No issues.

We also change the inlining to be a little more conservative on static
field getters, as a static field may need to do a lazy initialized check
and call initializer function.

We also give the initializer function a better name.

Change-Id: I5d9b138c9fcb41f8580602fd1ba9ec5aa4af5341
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467820
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2025-12-16 03:09:19 -08:00
Martin Kustermann b0e18fa40b [dart2wasm] Fix bug in @pragma('wasm:static-dispatch') & remove corresponding dispatch table entries
There was a bug in `CallTarget.signature` which triggers if there's only
one entry that's statically dispatched against, which causes us to
inline the polymorphic dispatcher, which relies on this (previously
incorrect) signature.

The CL also changes the dispatch table building logic to not allocate
table entries for the statically dispatched regions (as they would
never be used).

Change-Id: Ic2d0c387e8863e89ef811e1892642fe81df9189a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468000
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-12-16 01:42:00 -08:00
Martin Kustermann 368cde8f27 [dart2wasm] Do not hold onto sources in Kernel AST
This removes 400+ MB of RAM usage when compiling big apps.

Issue https://github.com/dart-lang/sdk/issues/62110

Change-Id: Ia98395a7d3498a677dc6202fd56b4f7ecbf6c930
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468301
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-12-16 01:41:31 -08:00
Sam Rawlins 7cad5f5e52 analyzer: Improve names of unused_element parameter tests
We don't have a strict rule set for naming test methods, but the general
idea of grouping terms with underscores (and breaking an otherwise
rather universal rule of using camelCase) is to help to group like
test cases (aided by our alphabetical sorting enforcement).

There were examples in this file that really broke the grouping
mechanism by not using consistent grouping. Here are the broad strokes
of what I changed; no test bodies were changed, _only names_, but the
CL is hard to review because of sorting.

* `test_classGetterSetter_...` and `test_classSetter_...` were renamed
  to use `class` as a group (`test_class_getterSetter_...` and
  `test_setter_...`) consistently.
* `test_factoryConstructor_...` were renamed to use `constructor` as
  the group base (`test_constructorFactory...`).
* `test_optionalParameter_...` were renamed to use `parameter` as the
  group base (`test_paramter_...`). This is the bulk of the change.
  There were previously dozens of tests starting with
  `test_optionalParameter_` _and_ dozens of tests starting with
  `test_parameter_`. However, `unused_element` only concerns itself
  with optional parameters, so that can be the default meaning of
  `test_parameter_`. (Similar to classes; we don't report any public
  classes as unused, but we don't need to write `private` in every
  test case.)
* In the parameter tests, there was an inconsistent placement of the
  group `isUsed` or `notUsed`. It seems like the bulk of tests place
  the `isUsed` or `notUsed` grouping earlier rather than at the end of
  the test name, so I went with that for this consistency CL.

Change-Id: I54be6591615d015ae9cf87ee4c9726ed7cfee209
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468180
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-12-15 20:33:10 -08:00
Sam Rawlins 3761de3441 analyzer: Update the "new language feature" task list for warnings
I won't claim that this list is perfectly complete, but I will claim
that it's _more_ complete. :D

Change-Id: If0b2a4e32b10ef0c140f3cbf77d6e5abfcb918b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-12-15 20:15:01 -08:00
Paul Berry fb19233ff8 [messages] Use lowerCaseName in verify_docs.
Change the `verify_docs` package's use of `DiagnosticCode.name` to
`DiagnosticCode.lowerCaseName`. There is no functional change since
all diagnostic codes generated by the analyzer are already in lower
case.

This helps pave the way for eventually deprecating and removing
`DiagnosticCode.name`, which will help ensure that analyzer clients
treat diagnostic codes in a case-insensitive fashion.

Change-Id: I6a6a69645300e89b1bed342804d5e89ae9cf556b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468141
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-12-15 17:45:52 -08:00
Ryan Macnak 583fbe5962 [vm] Symbolize more Windows errors.
TEST=build
Bug: https://github.com/dart-lang/sdk/issues/62249
Change-Id: I66e5cff2c965c1078ee59338bf5f0c4d061cec95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468400
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-12-15 15:45:21 -08:00
Sam Rawlins c034cacd41 analyzer: Update comment in NullSafeApiVerifier
It doesn't make sense to say "when null-safety is enabled" any longer.

Also add a TODO note referring to a GitHub issue.

Change-Id: Ib27ea9a8054fee5fa663ed85c7fec6a72fb01961
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468140
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-12-15 14:40:44 -08:00
DEPS Autoroller c7f4fd8a4b Roll Fuchsia SDK from 30.20251211.4.1 to 30.20251212.4.1
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/fuchsia-sdk-dart-sdk
Please CC fuchsia-3p-engprod@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Fuchsia SDK: https://bugs.fuchsia.dev/p/fuchsia/issues/list
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try;luci.dart.try:vm-fuchsia-release-arm64-try
Change-Id: I2947c1e2b0bc059bf3fdc635a823b6901b8a5e0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467960
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2025-12-15 14:31:06 -08:00
Sam Rawlins 74a5794887 analyzer: Rename "error" variables to be "diagnostics"
This is cleanup from renaming types like `DiagnosticCode`. I found these
variables which also need to be renamed.

Change-Id: I0e6d0633009c9c2b5d719f4c911295f9ded4e257
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468160
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-12-15 14:24:16 -08:00
Jake Macdonald 42e7de8f6c add the ability to run a single scenario, fix results getter
Change-Id: I74e0e0ddb20a2182d4dc4f5e37ffb6c1925ee4f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468360
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-12-15 13:51:30 -08:00
DEPS Autoroller 47243fb633 Roll BoringSSL from 29e2ef6cc121 to 53844eb8bb2a (8 revisions)
https://boringssl.googlesource.com/boringssl.git/+log/29e2ef6cc121..53844eb8bb2a

2025-12-12 rpolzer@google.com EVP_AEAD: implement sealv/openv for AES-CCM.
2025-12-12 rpolzer@google.com EVP_AEAD: implement sealv/openv for AES-EAX.
2025-12-12 rpolzer@google.com EVP_AEAD: add a helper to process iovecs on a per-block basis.
2025-12-12 rpolzer@google.com Move `err_data.cc` symbols into the `bssl` namespace.
2025-12-11 dimitri.ledkov@surgut.co.uk Link to CMVP certificate for 20240407
2025-12-11 rpolzer@google.com Fix a missing incldue in `aead.cc.inc`.
2025-12-11 rpolzer@google.com Revert "Revert the initial seal/openv implementations"
2025-12-11 rpolzer@google.com AEAD tests: fix accidental bit overlap.

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/boringssl-dart-sdk
Please CC dart-engprod@google.com,dart-vm-gardener@grotations.appspotmail.com,dart-vm-team@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in BoringSSL: https://crbug.com/boringssl/new
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Tbr: dart-vm-gardener@grotations.appspotmail.com
Change-Id: I35d374753e1a5d185f225d9a46a2ae47faaec8cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467940
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-12-15 13:42:50 -08:00
Brian Quinlan 5eecbb5a27 Revert "Roll Clang from f77ce52b56d0 to 9a5fa3075ac6"
This reverts commit 65f16e3269.

Reason for revert: Causes TSAN failures

Original change's description:
> Roll Clang from f77ce52b56d0 to 9a5fa3075ac6
>
> If this roll has caused a breakage, revert this CL and stop the roller
> using the controls here:
> https://autoroll.skia.org/r/clang-dart-sdk
> Please CC dart-engprod@google.com,dart-vm-gardener@grotations.appspotmail.com,dart-vm-team@google.com on the revert to ensure that a human
> is aware of the problem.
>
> To file a bug in Clang: https://bugs.fuchsia.dev/p/fuchsia/issues/list?q=component%3AToolchain
> To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues
>
> To report a problem with the AutoRoller itself, please file a bug:
> https://issues.skia.org/issues/new?component=1389291&template=1850622
>
> Documentation for the AutoRoller is here:
> https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
>
> Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try;luci.dart.try:dart-sdk-linux-arm64-try;luci.dart.try:dart-sdk-mac-try;luci.dart.try:dart-sdk-mac-arm64-try;luci.dart.try:dart-sdk-win-try;luci.dart.try:vm-asan-mac-release-arm64-try
> Change-Id: Ia893f84d6979e722f5c293087f866c40707f868a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467760
> Commit-Queue: Alexander Aprelev <aam@google.com>
> Reviewed-by: Brian Quinlan <bquinlan@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>

Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try;luci.dart.try:dart-sdk-linux-arm64-try;luci.dart.try:dart-sdk-mac-try;luci.dart.try:dart-sdk-mac-arm64-try;luci.dart.try:dart-sdk-win-try;luci.dart.try:vm-asan-mac-release-arm64-try
Change-Id: I881b0e7cda4e7aa2990527851926984c84299034
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468321
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2025-12-15 12:38:41 -08:00
Brian Wilkerson ba35276ae2 Add completion support for primary constructors
This adds completion support in the class header. Support for completion
in the body will be added in a separate CL.

Please look carefully at the tests to ensure that there aren't holes in
the coverage.

Change-Id: I189f25fbb90f43b4d8993622d5eb025d3160bef1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467920
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-12-15 11:31:17 -08:00
Paul Berry 277cee68a4 [messages] Convert bodyMightCompleteNormally checks to use literate diagnostic API.
Converts the code that reports diagnostic codes
`bodyMightCompleteNormally` and `bodyMightCompleteNormallyNullable` to
use the literate diagnostic reporting API.

This was not a straightforward conversion because the code for
reporting these diagnostics
(`ResolverVisitor.checkForBodyMayCompleteNormally`) made use of the
`DiagnosticReporter.atConstructorDeclaration` method, which doesn't
have a direct analogue in the literate diagnostic API. The equivalent
formulation in the literate diagnostic API is to call
`ConstructorDeclarationExtension.errorRange` to compute the offset and
length for the constructor name, and then pass the result to
`LocatableDiagnostic.at`.

Note that the previous version of
`ResolverVisitor.checkForBodyMayCompleteNormally` used an `if`/`else`
chain to handle three possible types for `errorNode`:
`ConstructorDeclaration`, `Token`, or `BlockFunctionBody`. But the
call sites might pass in any sort of `FunctionBody`. So it appeared
that the diagnostic would be accidentally dropped in the case where
`errorNode` was some other type of `FunctionBody`. However, it turns
out that there was a tricky reason why the diagnostic was never
accidentally dropped: the call site that passes in a `FunctionBody`
also passes the same `FunctionBody` for the `body` parameter, and
`ResolverVisitor.checkForBodyMayCompleteNormally` only checks for
`bodyMightCompleteNormally...` errors if `body` is of type
`BlockFunctionBody`.

In the new code, a `switch` expression is used to compute the range
over which the diagnostic should be reported, so it is manifestly
clear that the diagnostic is never accidentally dropped.

Change-Id: I6a6a69647a8fd1928d935ec8b5cb0c733ad2412f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467540
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-12-15 10:36:40 -08:00
Sam Rawlins 13119ed91c DAS plugins: Fix race condition between plugin startup and a change in overlays
Fixes https://github.com/dart-lang/sdk/issues/62214

Danny describes the problem at a high level in https://github.com/dart-lang/sdk/issues/62214.

At a lower level, the issue is that we add the new `PluginIsolate` to
the `_pluginMap` as soon as we instantiate it! Before we've even made
the request to start it up. The `_pluginMap` is how PluginManager sends
out various requests, like watch events, priority files, and update
content.

The fix is easy enough: we wait to add the PluginIsolate to the `_pluginMap` until after we've awaited `PluginIsolate.start`.

Change-Id: I05e6314fde10fbaf4cf25b38b526c5cf96bd65ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467923
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-12-15 10:33:38 -08:00
Nicholas Shahan 03bb1c75d6 [ddc] Use correct async timing on deferred imports
The correct async timing is now always enabled by default.

Change-Id: Ic7489668af14e1acd6069019121e0ff381f0c8a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467442
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2025-12-15 10:08:39 -08:00
Ben Konyi 262d9eb262 [ DDS ] Remove x-frame-options=SAMEORIGIN from default response headers
This response header entry prevents DevTools from being embedded in
iframes, which is needed to embed the DevTools inspector within the
Flutter widget preview environment.

TEST=Manually verified with `flutter widget-preview start`

Change-Id: Ic4ec3cf0e23509a6c0cbc94ab636a18c6abf733f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468020
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-12-15 10:08:02 -08:00
Paul Berry 8600df906e [messages] Add SyntacticEntity.sourceRange getter.
This will allow diagnostic reporting code in the analyzer to be more
easily converted to the new literate diagnostic reporting API, because
it will make it possible to use `SourceRange` as the common
denominator for situations where the location where a diagnostic needs
to be reported might come from either a `SyntacticEntity` or a
`SourceRange`.

Change-Id: I6a6a6964f3ec2ea33e8900d93b5abe714c9e1dcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467682
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-12-15 09:02:26 -08:00
Nate Biggs 774c454ffa [dart2js] Fix duplication of code after for..in loop containing a break.
`builder.current` at the time of creating the labelGraph is the block
after the body. So setting that as the end node of the subGraph was
including all the code after loop into the body of the labeled
statement.

Instead we use the `bodyBlock` as the end of the labelGraph as this is
the last block in the body of the loop. If no such body exists, we use
the `conditionEndBlock` which is the block right before the body (and
still includes the logic to exit the loop).

Also changes codegen to not emit a labelStatement if it has no body.
AFAICT we don't do DCE on flow blocks so codegen is the best time to
avoid emitting this code.

Bug: https://github.com/dart-lang/sdk/issues/62185
Change-Id: Ia80cc7d3b44782c6193a67e8adbbc66f00b8f133
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468060
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2025-12-15 08:55:50 -08:00