Skip to content

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

@srujzs

Description

@srujzs

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.

Metadata

Metadata

Assignees

Labels

area-dart2wasmIssues for the dart2wasm compiler.web-js-interopIssues that impact all js interop

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions