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

FunctionType cast method doesn't allow null in weak mode #41680

Closed
nshahan opened this issue Apr 27, 2020 · 0 comments
Closed

FunctionType cast method doesn't allow null in weak mode #41680

nshahan opened this issue Apr 27, 2020 · 0 comments
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. NNBD Issues related to NNBD Release web-dev-compiler

Comments

@nshahan
Copy link
Contributor

nshahan commented Apr 27, 2020

Repro:

main() {
  foo(null as dynamic);
}

void foo(dynamic fn(dynamic)) => print("Hello from foo");

This program throws in weak mode when it should allow null:

Error: Expected a value of type '(dynamic) => dynamic', but got one of type 'Null'
@nshahan nshahan added web-dev-compiler area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. NNBD Issues related to NNBD Release labels Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. NNBD Issues related to NNBD Release web-dev-compiler
Projects
None yet
Development

No branches or pull requests

1 participant