Skip to content

nnbd tool should create casts for function types #40384

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

Closed
MichaelRFairhurst opened this issue Jan 29, 2020 · 1 comment
Closed

nnbd tool should create casts for function types #40384

MichaelRFairhurst opened this issue Jan 29, 2020 · 1 comment
Labels
area-migration (deprecated) Deprecated: this label is no longer actively used (was: issues with the `dart migrate` tool). nnbd-migration-correctness-example Concrete examples of the migration engine producing an incorrect result on a phase 1 package P2 A bug or feature request we're likely to work on

Comments

@MichaelRFairhurst
Copy link
Contributor

In package:async, there are some compile errors from lazy test nulls combined with migrated async apis.

...
// in tests
onCancel = () => null;
...
CancelableOperation(..., Future<R> Function() onCancel: onCancel) ...
...
... Completer.complete(Future.sync(onCancel)) ...

the null causes the type of onCancel to be Future<R>? Function(). That is an illegal assignment to the parameter of Future.sync (Future<T> Function()).

Ultimately, the correct migration is probably to change the test to

onCancel = () async => null;

but in terms of an output we can expect the migration tool to produce, we can emit a cast when passed into Future.sync:

...
... Completer.complete(Future.sync(onCancel as Future<R> Function())) ...

In the long run, this ideally will be highlighted as a place users should manually review

@MichaelRFairhurst MichaelRFairhurst added legacy-area-analyzer Use area-devexp instead. analyzer-nnbd-migration nnbd-migration-correctness-example Concrete examples of the migration engine producing an incorrect result on a phase 1 package labels Jan 29, 2020
@srawlins srawlins added the P2 A bug or feature request we're likely to work on label Sep 8, 2020
@stereotype441 stereotype441 added area-migration (deprecated) Deprecated: this label is no longer actively used (was: issues with the `dart migrate` tool). and removed analyzer-nnbd-migration legacy-area-analyzer Use area-devexp instead. labels Nov 16, 2020
@stereotype441
Copy link
Member

As of 1c7fe71, the null safety migration tool has been removed from active development and retired. No further work on the tool is planned.

If you still need help, or you believe this issue has been closed in error, please feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-migration (deprecated) Deprecated: this label is no longer actively used (was: issues with the `dart migrate` tool). nnbd-migration-correctness-example Concrete examples of the migration engine producing an incorrect result on a phase 1 package P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

3 participants