Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent and incorrect nullability checks for JS interop return types and callback parameter types #56004

Closed
srujzs opened this issue Jun 14, 2024 · 0 comments
Assignees
Labels
area-dart2wasm Issues for the dart2wasm compiler. web-js-interop Issues that impact all js interop

Comments

@srujzs
Copy link
Contributor

srujzs commented Jun 14, 2024

Our current handling of nullability of interop types are inconsistent:

if (returnType.isPotentiallyNonNullable) {

if (!callbackParameterType.isPotentiallyNullable) {

In the callback parameter case, we add a null-check if the type is not potentially nullable, and in the return type case, we add a null-check if the type is potentially non-nullable. Both only handle some of the cases correctly. The right alternative for both cases is if the nullability is Nullability.nonNullable, place a null-check, and if it's Nullability.undetermined, cast.

@srujzs srujzs added web-js-interop Issues that impact all js interop area-dart2wasm Issues for the dart2wasm compiler. labels Jun 14, 2024
@srujzs srujzs self-assigned this Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dart2wasm Issues for the dart2wasm compiler. web-js-interop Issues that impact all js interop
Projects
Status: Done
Development

No branches or pull requests

1 participant