dart-sdk/tests
Mayank Patke ca3e67a3b6 [dart2js] Add --interop-null-assertions.
This CL adds a new --interop-null-assertions flag (cf.
--native-null-assertions) with the goal of validating that JS interop
APIs with non-nullable static return types do not return null values.
This flag is currently disabled by default but is intended to assist in
sound null safety migrations.

In general, we don't guarantee type soundness of package:js interop
since users can write incorrect static types which are not backed by
any runtime checks. However, it is likely that during the null safety
migration, some interop APIs which should have been made nullable
weren't. Therefore, we want to offer some additional (but limited)
checking for this case.

For static invocations of functions with non-nullable return types, we
can simply perform a null check on the result of the call.
For instance methods (which could be invoked virtually/dynamically), we
want to perform a null check on the return value in the callee (the
interceptor method) itself when possible.

It's possible for multiple interop bindings to share the same
interceptor method. We produce a null check in the interceptor method
body if all the methods have non-nullable return types. Otherwise, we
insert checks at callsites when appropriate.

Change-Id: Ifd155d7f8326152b6d57d61199e0b7973c4a1211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369784
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2024-06-12 21:28:23 +00:00
..
co19 [co19] Roll co19 to 0a9f7daccd0e682ab791f04ecc23f1dbcee04977 2024-06-03 09:12:56 +00:00
corelib Clean up DateTime tests 2024-06-07 17:58:32 +00:00
dartdevc Reland "Tweak expect.dart library." 2024-04-26 15:28:26 +00:00
ffi [vm] Native asset relative path resolution with symlinks 2024-06-12 16:45:19 +00:00
hot_reload [reload_test] Adding several new reload tests. 2024-05-01 20:01:19 +00:00
language [test][wildcard-variables] Fix typedef record type. 2024-06-12 18:43:39 +00:00
lib [status_files] Cleanup status files 2024-06-12 10:21:23 +00:00
macro_build add package:_macros (SDK vendored) and package:macros (pub published) 2024-03-26 18:40:00 +00:00
modular Support prebuilt macros in the incremental compiler mode for DDC 2024-04-09 07:37:26 +00:00
standalone [status_files] Cleanup status files 2024-06-12 10:21:23 +00:00
web [dart2js] Add --interop-null-assertions. 2024-06-12 21:28:23 +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 [wiki] move the https://github.com/dart-lang/sdk/wiki to the docs/ dir 2024-05-16 18:19:40 +00:00

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