Commit Graph

23554 Commits

Author SHA1 Message Date
Kallen Tu 89e545c5cc [dot-shorthands][co19] Rename enum-shorthands flag to dot-shorthands (and roll co19 to b14b080)
We've decided to rename enum shorthands to dot shorthands. It describes the entire feature better. It's not only for enum values. We'll update the experiment name before the implementation goes in, that way our users can use a flag that matches the actual feature name.

Additionally, roll co19 to b14b0802e696a60c79b00d0f052e26fb986f0faf so we can avoid an infra failure with co19 using what's now an unknown feature flag (enum-shorthands).

2025-02-06 sgrekhov22@gmail.com Fixes dart-lang/co19#3067. Rename the static access shorthand feature experiment flag (dart-lang/co19#3068)

Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try
Bug: https://github.com/dart-lang/sdk/issues/57037
Change-Id: I031e3bce8166145b24dbb77acf259d78e6e00f0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407603
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-02-07 07:38:32 -08:00
Srujan Gaddam 8aa6b413eb [ddc] Update hot reload test suite to use recompile-restart
A new optional suffix to the file names is added: '.restart'.
This allows us to differentiate between hot reload generations
and hot restart generations. All files with the same generation
should either have the suffix or don't. If present, uses the
recompile-request instruction in the frontend server. If not,
uses the recompile instruction. Tests are renamed and a WIP
README is added to document this change.

Change-Id: I2691c5ec0b7336115a76dc0e0369213e74b6ea21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406183
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-02-05 14:51:21 -08:00
Robert Nystrom 7134a451f3 Format tests/language/i*.
A lot of files in this one, but nothing interesting in any of the tests.

Change-Id: I69c705bfd2c2b2f9711b393e4ac78c357336e1a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407660
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2025-02-05 08:36:21 -08:00
Robert Nystrom 81f7324165 Format tests/language/l*.
Change-Id: I9551c5e26f513e92325367ff98a6076614093667
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407680
Reviewed-by: Lasse Nielsen <lrn@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2025-02-04 14:28:36 -08:00
Daco Harkes 74f2d4b1af [vm/ffi] Error on invoking callback from leaf call
All callbacks flow via the single runtime entry, so we add a check
there.

TEST=tests/ffi/function_callbacks_leaf_test.dart

(The transition verification in
https://dart-review.googlesource.com/c/sdk/+/407021
doesn't catch the error. The callbacks already transitioned before
reaching the generated code in that CL.)

Closes: https://github.com/dart-lang/sdk/issues/60021
Change-Id: Ia6bf8af186c9c8c5a66cffa537d80421467330d4
Cq-Include-Trybots: dart/try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-ubsan-linux-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407023
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-02-04 03:36:29 -08:00
Lasse R.H. Nielsen 0dfbab89cb Make tests/lib/js/static_interop not use minitest.
Change-Id: Id7a8a6ac0098df55b04fa089587c62b07e9cf3c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403860
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2025-02-04 01:44:02 -08:00
Ivan Inozemtsev e534983216 Linkable AOT snapshots on macOS
Update `aot_snapshot` template to optionally build a shared library
from `app-aot-assembly` sanpshot.

Change-Id: Ifb7cee65b5699099fa676312fff7d687cfb52d98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407060
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
2025-02-03 23:31:21 -08:00
Robert Nystrom 36f0c3209a Format tests/language/g*.
Change-Id: I7cfc51c22e98cc368ec59af3a7125f1d0c0419d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407140
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-02-03 03:33:13 -08:00
Robert Nystrom 3166d7188f Format tests/language/e*.
Since I regenerated the test expectations, this also fills in a few
unspecified errors with more precise information.

Change-Id: I4a2450de030a7d38b08f30f46d9d9feca99404f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407082
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2025-02-03 03:29:35 -08:00
Johnni Winther 7b9c5d938b [ddc,frontend_server] Remove macro tests
Change-Id: I1227eaed501e0175859e3c7759d88a8b19e8f4d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406964
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2025-02-03 00:37:19 -08:00
MarkZ 3396a7b92a [tests] Adding ddc and vm specific hot reload differences.
Change-Id: If2a398bc8020438b7c46e58cba03180bfa61b660
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407180
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-01-31 21:31:49 -08:00
MarkZ ebbdbe4ef8 [tests] Porting instance and hierarchy change tests to the hot reload framework.
Change-Id: I7a11a43d34772f2020dda235327da71fa388f3ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406062
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-01-31 15:13:18 -08:00
Robert Nystrom 6ccd2fb250 Format tests/language/d*.
I removed one clearly dead multitest piece, but otherwise didn't try
to clean things up. There's definitely something weird about the dynamic
field tests, but I don't even know what they should be doing, so left
them alone.

Change-Id: Ic80c2b26d640da0aafeededaa981ed8c2fecc93a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406920
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2025-01-31 13:53:22 -08:00
Kallen Tu 1c91d215cc [tests] Enum Shorthands - == and selector chain tests.
Similar format of tests to https://dart-review.googlesource.com/c/sdk/+/401980 and the other `==` and `!=` tests.

Making sure that equality with shorthand selector chains is allowed when the shorthand is on the RHS. Errors are produced when the shorthand is on the LHS, doesn't have the proper context, or has the context type of `Object`.

Bug: https://github.com/dart-lang/sdk/issues/57038
Change-Id: I905793b400a6f8b3c6bd068f70654dbbeec38557
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403965
Reviewed-by: Erik Ernst <eernst@google.com>
2025-01-30 15:25:48 -08:00
Alexander Markov aa34e70d50 Revert "Make Zone functions not call register*, but properly catch errors."
This reverts commit fc2c46ae82.

Reason for revert: broke Flutter tests:
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8724303399273084113/+/u/Run_framework_coverage_tests/stdout
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8724303399273084097/+/u/Run_framework_tests_libraries_tests/stdout
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8724303399273084081/+/u/Run_framework_tests_misc_tests/stdout
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8724303399273084049/+/u/Run_framework_tests_widgets_tests/stdout
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8724303399273084033/+/u/Run_tool_tests_tests/stdout

Original change's description:
> Make Zone functions not call `register*`, but properly catch errors.
>
> Make `Zone.createTimer`, `Zone.createPeriodicTimer` and `Zone.scheduleMicrotask`
> not call register on the same zone.
> These are low-level functions that should not build on top
> of other low-level functions.
>
> Instead the function is registered in the `Timer` constructors and
> top-level `scheduleMicrotask` code, and the root zone's `createTimer`
> and `scheduleMicrotask` just make sure that the callback will run
> in its original zone, and that uncaught errors are handled in the
> correct zone.
> Avoids a double-registration that timers did.
>
> Significant clean-up.
> - The private `_Zone`, `_ZoneSpecification` and `_ZoneDelegate`
>   subclasses are not necessary now that their superclasses are `final`.
> - Stopped using type aliases instead of function types
>   and old-style function arguments.
> - Renamed some parameters to not be, fx, `f`.
>
> Avoided some closure allocations for microtasks by putting the zone
> into the queue entry, instead of wrapping the callback in a closure calling `zone.run`.
>
> This is a potentially visible change if any code uses the zone functions
> directly and expect them to invoke `Zone.register*`.
> (Suspiciously no test failed with this change. May need to add some.)
>
> Fixes #59913.
>
> CoreLibraryReviewExempt: Have had all +1s, just not at the same time.
> Bug: https://dartbug.com/59913
> Change-Id: Ie3c87f5f22aedcbe30ab04718df98e1c0f0659c3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405020
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

Bug: https://dartbug.com/59913
Change-Id: I386b2b6d2594a50a7597363e13fe24111ea72ade
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406685
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2025-01-30 09:48:40 -08:00
David Morgan 126af93f38 Remove macros build tests.
Change-Id: I2e86ecb8298713597780b23416e3bf1832cfd50e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406821
Commit-Queue: Morgan :) <davidmorgan@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2025-01-30 09:11:16 -08:00
David Morgan 497a88bb26 Remove macros language tests.
R=jakemac@google.com

Change-Id: I456098fd97d21f9f5bdeed66b2874c1c6e4e78eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406847
Auto-Submit: Morgan :) <davidmorgan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
2025-01-30 09:09:14 -08:00
Nate Biggs 5855d91ba8 [ddc] Correctly extend type parameters for factory constructors.
RtiTypeEnvironment currently does not support being extended. However it's used for factory constructors which themselves can have generic functions defined in their bodies. This means we have to allow the ability to extend RtiTypeEnvironments as well.

Bug: https://github.com/flutter/flutter/issues/160338
Change-Id: I9b4e79b44f503a4a987e0c38da86fdce81361e4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406344
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-01-30 08:07:30 -08:00
Lasse R.H. Nielsen fc2c46ae82 Make Zone functions not call register*, but properly catch errors.
Make `Zone.createTimer`, `Zone.createPeriodicTimer` and `Zone.scheduleMicrotask`
not call register on the same zone.
These are low-level functions that should not build on top
of other low-level functions.

Instead the function is registered in the `Timer` constructors and
top-level `scheduleMicrotask` code, and the root zone's `createTimer`
and `scheduleMicrotask` just make sure that the callback will run
in its original zone, and that uncaught errors are handled in the
correct zone.
Avoids a double-registration that timers did.

Significant clean-up.
- The private `_Zone`, `_ZoneSpecification` and `_ZoneDelegate`
  subclasses are not necessary now that their superclasses are `final`.
- Stopped using type aliases instead of function types
  and old-style function arguments.
- Renamed some parameters to not be, fx, `f`.

Avoided some closure allocations for microtasks by putting the zone
into the queue entry, instead of wrapping the callback in a closure calling `zone.run`.

This is a potentially visible change if any code uses the zone functions
directly and expect them to invoke `Zone.register*`.
(Suspiciously no test failed with this change. May need to add some.)

Fixes #59913.

CoreLibraryReviewExempt: Have had all +1s, just not at the same time.
Bug: https://dartbug.com/59913
Change-Id: Ie3c87f5f22aedcbe30ab04718df98e1c0f0659c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405020
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-01-30 06:58:51 -08:00
Nate Biggs 44dfe081b2 [ddc] Add a covariant parameter check for optional nonnullable parameters with null initializer on lowered constructor tearoffs.
Change-Id: I77379ee43173ddbbdee25083bd641968eeeb787f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406500
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-01-29 23:07:26 -08:00
MarkZ 0083128537 [tests] Using git diff over diff for stability in hot reload tests.
Change-Id: Icdbdf4c569fd8ab5de96560722ac62616185a751
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406224
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2025-01-29 16:17:13 -08:00
Nate Biggs 05d293aac2 Move web regression tests into langauge suite.
Change-Id: Id1b61a345be94965f2ca8da228d694a1e13d2f92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406381
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2025-01-29 12:00:13 -08:00
MarkZ b6778c956b [test] Porting mixin hot reload tests.
Change-Id: Ie9aedb99878cf4adb40949e8127c6e254dba1162
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406061
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2025-01-28 17:37:09 -08:00
Paul Sturm f5e6ff5095 Avoid throwing an exception if authentication isn't requested
Only process authentication if there are credentials available or an
authenticate callback to get credentials. This prevents an exception
being thrown for a malformed www-authenticate header when the client
code hasn't asked HttpClient to perform authentication.

R=sra@google.com

Bug: https://github.com/dart-lang/sdk/issues/46442
Change-Id: I3d3e70cec936f717f822b2fe170ddc526a74ebf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405280
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-01-28 12:32:24 -08:00
Ivan Inozemtsev 6e33c95463 Dart Engine
Adds shared libraries for embedding Dart VM and new API (runtime/engine/include/dart_engine.h).

TEST=tests/standalone/embedder_samples_test.dart

Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv32-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-aot-win-product-x64-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-appjit-linux-product-x64-try,vm-appjit-linux-release-x64-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-product-arm-try,vm-ffi-android-product-arm64c-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try,vm-gcc-linux-try,vm-linux-debug-ia32-try,vm-linux-debug-simriscv32-try,vm-linux-debug-simriscv64-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-linux-release-arm64-try,vm-linux-release-ia32-try,vm-linux-release-simarm-try,vm-linux-release-x64-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-mac-release-arm64-try,vm-mac-release-x64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,vm-msvc-windows-try,vm-reload-linux-debug-x64-try,vm-reload-linux-release-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-reload-rollback-linux-release-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-ubsan-linux-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try,vm-win-release-x64-try
Change-Id: Ia4e4d1b871ddef515cfb2f4639bdaa9fe3676936
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402860
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-01-28 03:53:40 -08:00
Nate Biggs b969f32a76 [dart2wasm] Store exception/stacktrace for nested catch blocks.
The async state machine uses a single state in the heap to store the current exception and stacktrace when within a catch block in case they need to be rethrown. When catch blocks are nested this state can be overwritten.

With this new change, before entering a new catch we store the current value of the exception/stacktrace in a local that we can restore after exiting the associated catch blocks. A wasm catch can represent multiple Dart catch blocks so we only need to store the state per wasm catch.

Fixes: https://github.com/dart-lang/sdk/issues/59981
Change-Id: I738084fdecdf5aceac65c5d3698e40b791175171
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405920
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-01-27 07:58:31 -08:00
Nicholas Shahan 4fce27b1f7 [tests] Fix formatting when writing diffs
* Normalize white space around source code strings before producing
  diffs by trimming and appending a single newline character.
* Write an empty line between the source code and diff text in
  generation files.
* Run dart format on all test files.

With these changes you should be able to run the hot reload suite with
`--diff write` and dart format the code multiple times without
introducing changes in the file.

Change-Id: Ifc0b1dd7032bd448f5f6568c5aa3c18dde076c71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405247
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2025-01-24 09:07:01 -08:00
Nicholas Shahan 5ec1002eff [ddc] Port library show/hide hot reload tests
Change-Id: Iaa7ef742f1204c73e96738cdba774f1263b32797
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405061
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2025-01-21 16:36:01 -08:00
Mohamed Abdelaal 9b7bb9df90 Fix "the the" typo
Closes https://github.com/dart-lang/sdk/pull/59926

GitOrigin-RevId: cb37bca473b0c177b876a0f4e75858cd1862e699
Change-Id: I6827241b22e99db455945afcdfbaee0450999ce9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404923
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-01-21 14:08:20 -08:00
Dhikshith Reddy 41a8e8147f [CoreLib] Iterable.withIterator
Closes https://github.com/dart-lang/sdk/pull/59908

GitOrigin-RevId: bf05a5468020756e5a16b34134c9ec472b95576f
Change-Id: Ie511e79c7cbc1e9230477913a54191730104f489
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404341
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-01-21 05:36:47 -08:00
Martin Kustermann f2929bfd51 [dartwasm] Do not preserve details for errors in --minify, move throwing code to (not inlined) slow path
* We outline throwing code to never-inlined function
* We inline index/range checking code using fast unsigned compares
* We omit details in `--minify` mode

The support for omitting details in `--minify` means that the
signature shaking pass will remove all parameters of the slow
paths in `--minify` mode, making them functions with no arguments
that just throw a constant as an exception.

Together these changes result in smaller code for common data
structures that do index/range checks. Which can have positive
effects downstream (e.g. less to inline for wasm runtimes).

This leads to around this (in -O2)

  FluteComplex.Compile.Size.wasm.opt    -0.514 %
  FluteComplex.Compile.Size.wasm.opt.gz -1.664 %
  Hello.Compile.Size.wasm               -2.298 %
  Hello.Compile.Size.wasm.opt.gz        -4.864 %

It also leads to (in -O2) around 10% perf improvement on
`TypedDataPoly.*` benchmarks.

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

Change-Id: Icd1cdf28a061f7763bd4bac7cfd5eaeea150c469
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404301
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2025-01-20 04:52:01 -08:00
Paul Berry 7f5fc25331 [analyzer] Fix horizontal type inference when there are record types.
When record types were added to Dart, the analyzer's logic for
figuring out which type variables appear free in a given type wasn't
updated to recursively visit the types appearing inside a record
type. Fixing this issue brings the analyzer's behavior in line with
the CFE's behavior, and the spec.

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

Bug: https://github.com/dart-lang/sdk/issues/59933
Change-Id: I1da555d65f5d923c809d49a5c73c6d4c2837db18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405060
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
2025-01-17 11:41:15 -08:00
Ömer Sinan Ağacan 78ce85a7fe [dart2wasm,tfa] Don't infer class of string values in comparisons
In dart2wasm, when a comparison like `x == "hello"` is true, we can't
assume that the class of `x` is the same as the class of `"hello"`:

- If `x` is received from JS, it will be `JSStringImpl`.
- If it's a substring of a `TwoByteString`, it will be `TwoByteString`.
- Otherwise it will be `OneByteString`.

Update `Target` with the new method

```
bool get canInferStringClassAfterEqualityComparison => true;
```

to allow TFA to *not* infer classes of string values after comparisons.

Override the method to return `false` in dart2wasm's `Target`
implementation.

Fixes #59901.
Tested: web/wasm/issue_59901_test
Change-Id: I1a6c8deaf27c54240dd4e821dbd8160914502ad7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404562
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2025-01-16 03:24:39 -08:00
Lasse R.H. Nielsen 722e4f2cca Update isolate tests.
Remove uses of async_minitest and multitests.

Removed two files that were checking dynamic behavior that no longer exists (compile-time errors reported at runtime).

Rewrote and/or added to enum_const_test.dart and _deferred_in_isoltae_test.dart.

Otherwise mainly removing multitest `//# ok:...` comments, or `//# 01: ...error...` that only existed because the test failed in dart2js, along with anything else that tried to special-case dart2js (which no longer supports isolates at all).
Some sporadic general clean-up like removing library names.

Change-Id: I99b55f05710347343286e86b37ce02f1006868dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402700
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-01-15 05:49:03 -08:00
Martin Kustermann 61336f32ab [dart2wasm] Mark timing out test as SkipSlow on all browsers, not just Chrome
The root cause is that an `asyncEnd()` doesn't get executed which
will make the test not print `unittest-suite-success` which will
make the test controller keep waiting indefinitly until the test
times out.
=> This is true on all browsers, not just Chrome

Though commandline JS engines don't have this problem as they will
simply exit once there's no longer work and event loop is empty.

=> Here the test runner will recognize the missing
   `unittest-suite-success` and report the tests as failing.

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

Change-Id: Id217e9bd715d99f9927e7e18b03385aa2880b27f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404107
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-01-14 05:20:33 -08:00
Kallen Tu ef771d4953 [tests] Enum shorthands - Import prefixes.
Testing that enum shorthands work even with import prefixes of declarations.

Bug: https://github.com/dart-lang/sdk/issues/57038
Change-Id: I8026f062a2b405d4f92efff7abad1a03fa229eda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402425
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2025-01-10 10:05:40 -08:00
Kallen Tu 302287eed2 [tests] Enum shorthands - Selector chain tests for cascades, ??, collections and nested contexts.
Tests for nested context types, such as a constructor with an argument that also uses an enum shorthand.

Tests for selector chains. Multiple members and properties in one shorthand.

Bug: https://github.com/dart-lang/sdk/issues/57038
Change-Id: Ie9609b7594ccbe4347a59026d9e758868015fe64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402442
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-01-08 15:35:38 -08:00
MarkZ c033dd24af [ddc] Updating tearoffs to be evaluated on access.
Tearoffs are now represented as a closure that resolves an underlying bound context and property on access. `_boundMethod` and RTI getters must also be evaluated late.

Additionally, we now both canonicalize static methods and tag them with their types at class-declaration time (though lazily) - so that late resolved closures have access to their types.

Some tests have been updated to expect simpler errors. DDC traditionally emits slightly different errors that might aid in debugging.

Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401321
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2025-01-08 13:40:33 -08:00
Alexander Markov 3a73f32824 [vm,mirrors] reflectClass: throw ArgumentError for function and record types
TEST=tests/lib/mirrors/reflect_class_test.dart
Fixes https://github.com/dart-lang/sdk/issues/59863

Change-Id: Ic9ab394da9abeb7f793556a4827a496c372576a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403620
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-01-08 09:25:09 -08:00
Nate Biggs 057426eb7f [dart2js] Include block statements as potentially captured scopes.
Some scopes that are capturable by closures are not getting marked as such. Instead the parent scope (e.g. the enclosing member) is being treated as the captured scope that owns all the variable declarations down to the closure. The scopes are then being shared across different closures and variables with the same name are able to be overwritten.

This bug occurs for any block that isn't a loop or function (i.e. raw blocks, if blocks, try blocks). Loops are correctly handled as defining a scope and therefore those already work correctly.

Note: This may cause some small code size increase. There may now be extra assignements reseting capture boxes in more scopes.

Bug: https://github.com/dart-lang/sdk/issues/59843
Change-Id: Ic5009188795daabc1544f703fbeca01c0f1951d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403263
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2025-01-07 14:07:13 -08:00
Nate Biggs d80fab4a8a [dart2wasm] Fix dynamic switch casts.
If the switch's expression has type 'dynamic' and all the case expressions have the same type, we compare them using '=='. This requires a cast to ensure all the types match for the dispatch to the '==' function. However, we don't check that the type of the switch expression matches the type of the case expressions. So the cast fails if they don't match.

This adds a guard to ensure the types match before running through the case expressions. If the guard fails, we either jump to the default case or if there isn't one, we skip the switch entirely.

Fixes: https://github.com/dart-lang/sdk/issues/59782
Change-Id: I12e81f98d1c2046ee47e8ca4371642fd40620636
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402460
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-01-07 11:44:30 -08:00
Gabriel Terwesten 5c1796f4e0 [vm,ffi] Avoid linking test DLLs to dart.exe
The `ffi_test_functions` shared library needs to access functions from
`dart_api.h` and `dart_native_api.h`, which are only available in
the Dart executable.

UNIX shared libraries can have undefined symbols, which are resolved at
runtime and can be found in the loading executable. Windows DLLs cannot
have undefined symbols, but they can be dynamically linked to an
executable (in this case `dart.exe`). This requires the DLL to be able
to find the executable at runtime.

A better solution is to include implementations for the Dart APIs in the
DLL itself, that use `GetModuleHandle(NULL)` to get a handle to the
executable and `GetProcAddress` to get the address of the function.

This is what `dart_api_win.c` does.

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

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-win-release-ia32-try,vm-win-debug-x64c-try,vm-win-debug-x64-try,vm-win-debug-arm64-try,vm-msvc-windows-try,vm-aot-win-debug-x64c-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-product-x64-try,vm-aot-win-release-x64-try,vm-aot-win-release-arm64-try,pkg-win-release-try,pkg-win-release-arm64-try,dart-sdk-win-try,dart-sdk-win-arm64-try

Change-Id: I7f971a8ce21e03d18ed2967e74998f925c9236b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400582
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-01-07 08:15:39 -08:00
Stephen Adams 8cd13b290c [dart2js] Fix inconsistent treatment of statement
HArrayFlagsSet is compiled to a JavaScript statement, but the codegen predicate testing for when a condition subgraph can be compiled to an expression accepts HArrayFlagsSet because it tests for an instruction that has control flow (mostly jumps and checks).

Test for `isJsStatement()` instead.

Bug: #59790
Change-Id: Iafc21aa25490cb93503bb2be1f11dec2f71b5054
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403204
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2025-01-06 17:56:00 -08:00
Nate Biggs fb5fbf1dec [dart2wasm] Fix null checks being added on non-nullable value types.
Bug: https://github.com/dart-lang/sdk/issues/59840
Change-Id: Ifaac6430eabfee21e4971b3dd864e22f65c80adf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402980
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-01-06 10:32:33 -08:00
Robert Nystrom 6b21d8b559 Format tests/language/b*.
Change-Id: I4eb9cf0604a8a0e5227ab8f31db8309cbcabb336
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400147
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2025-01-06 10:24:30 -08:00
Nate Biggs d82e84ca2f [dart2wasm] Fix tearoff codegen on boxed types.
The struct type for closures requires the context value be a struct. If the tearoff is on an unboxed value, it first has to be boxed before being used to create the closure struct.

The new test currently fails at runtime (or via assertions at compile time) with this error:
"BoxedInt.abs tear-off" failed: struct.new[2] expected type (ref struct), found local.get of type i64

Change-Id: Ie861bc12a34b21f8b3415edadf55ce3d59f97580
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402560
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-01-06 10:23:43 -08:00
Lasse R.H. Nielsen df1df58988 Make SplayTreeMap entry values mutable.
No longer used as `MapEntry` directly, so no reason to
not update values in-place and avoid breaking key-based iteration.

Change-Id: I59a89811c783e33b6e4dccd553bc717e03968a9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396801
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-01-06 05:58:25 -08:00
MarkZ 29fe663917 [test] Porting VM enum tests to the hot reload test framework
Change-Id: I8fc17823e5236ab80d89d96c6e3f7d4b82b5b369
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402762
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2025-01-03 11:56:07 -08:00
Brian Quinlan 101e028d1f [io] Fix a bug where NUL was allowed in HTTP headers.
Bug:https://github.com/dart-lang/sdk/issues/56636
Change-Id: I88c579cfaaf0884cb3b582084b8739b060d8f439
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402541
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2025-01-02 12:13:15 -08:00
Robert Nystrom 0d63c97358 Reformat files in the top level of tests/language/.
Change-Id: I21e39caac0239bfe388e7c7f149723f3deafb87c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400221
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2025-01-02 03:27:35 -08:00