mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:06:59 +00:00
ca3e67a3b6
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> |
||
---|---|---|
.. | ||
co19 | ||
corelib | ||
dartdevc | ||
ffi | ||
hot_reload | ||
language | ||
lib | ||
macro_build | ||
modular | ||
standalone | ||
web | ||
legacy_status_dart2js.csv | ||
OWNERS | ||
README.md |
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.