dart-sdk/tests
Lasse R.H. Nielsen e86b08e5bb Forwards ignore bit to chained-to _Future.
If a target `_Future` is chained to another source `_Future`,
then it's because the target will complete with the same
result as the source future. Instead of keeping both
alive with a listener on the source which completes the target,
instead the target moves all its listeners to be directly on
the source, and keeps a link to the source in case more listeners
are added later.
The idea is that most futures are unreferenced after they have
had their first listener, so the target future has a chance
to be GC'ed.

If the target future has `.ignore()` called, and has no listener,
then the source completing with an error should not cause the
error to be uncaught. Without the optimization, the source would
have had a listener, and the target would ignore the error.

To simulate that, the source now gets a copy of the target's
`_ignoreUnhandledErrors` flag.

This is still not precisely the same as it would be without the
optimization. If *two* target futures are chained to the same source,
and only one of targes has `.ignore()` called, then this
implementation will make the uncaught error not be reported,
where it technically should.

(An alternative would be to *not* use chaining for futures
with `ignore()` called on them. But those are precisely futures
that are likely to be GC'able, because someone has already said
that they don't care if the future complete with errors.)

Fixes #54943

Bug: https://github.com/dart-lang/sdk/issues/54943
Change-Id: I0dbb4919ce2ea612d66539862fa0eb188aab8287
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352908
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2024-02-21 13:05:56 +00:00
..
co19 [test_runner] Rename host-checked to host-asserts 2024-02-08 22:01:09 +00:00
corelib [expect] introduce Expect.throwsWhen and Expect.throwsTypeErrorWhen 2024-02-14 20:12:05 +00:00
dartdevc [ddc] Delete variance tests for old DDC types 2024-02-14 22:29:33 +00:00
ffi [vm/ffi] Cleanup tests 2024-02-09 21:27:29 +00:00
language Fix analyzer handling of record literal type inference. 2024-02-20 20:21:48 +00:00
lib Forwards ignore bit to chained-to _Future. 2024-02-21 13:05:56 +00:00
modular [tests] Add repro for cross module constant 2023-11-13 22:21:40 +00:00
standalone [io] Make it possible to change the line ending output by stdout and stderr. 2024-02-16 20:06:03 +00:00
web [dart2wasm] Fix instantiation closure equality 2024-02-15 17:33:01 +00:00
legacy_status_dart2js.csv Spelling tests 2022-12-19 12:56:47 +00:00
OWNERS [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
README.md

This directory contains tests of the language and core library implementations. For more information, see https://github.com/dart-lang/sdk/wiki/Testing.