Skip to content

nnbd: function?.call() must be null-checked #40482

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
sortie opened this issue Feb 6, 2020 · 2 comments
Closed

nnbd: function?.call() must be null-checked #40482

sortie opened this issue Feb 6, 2020 · 2 comments
Assignees
Labels
legacy-area-analyzer Use area-devexp instead. NNBD Issues related to NNBD Release P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@sortie
Copy link
Contributor

sortie commented Feb 6, 2020

The analyzer doesn't appear to correctly handle a null checked call on a Function? in the following program:

Function? foo;

main() {
  foo?.call();
}

It produces the following analyzer errors:

Analyzing test.dart...
  error • The expression is nullable and must be null-checked before it can be used. • test.dart:3:3 • unchecked_use_of_nullable_value
1 error found.

These calls are supposed to work after talking to @lrhn and @eernstg.

The issue occurs for me at 43b69d4.

This issue blocks getting dart:_http clean of analyzer errors in NNBD mode as it has two such calls.

@sortie sortie added legacy-area-analyzer Use area-devexp instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) NNBD Issues related to NNBD Release labels Feb 6, 2020
dart-bot pushed a commit that referenced this issue Feb 7, 2020
This should fix all ddc isolate errors.  Remaining two io/_http errors are due to:
#40482

The rest are mirrors.  Do we think we'll be able to remove it altogether?  If not,
I can take a pass to fix.

Change-Id: I4cef9773b5fa36490bdfbc08a06fae6cd80c5eae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134860
Reviewed-by: Nicholas Shahan <[email protected]>
Reviewed-by: Sigmund Cherem <[email protected]>
@vsmenon vsmenon added the P1 A high priority bug; for example, a single project is unusable or has many test failures label Feb 10, 2020
@vsmenon
Copy link
Member

vsmenon commented Feb 10, 2020

@stereotype441 tentatively bumping priority on this, as it's the only issue left keeping the ddc sdk from being analyzer clean:

https://github.com/dart-lang/sdk/blob/master/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt

If this will take a while, we could probably workaround in dart:_http ( @sortie ?). That would unblock unforking / legacy, but we'll likely hit this shortly after that.

@scheglov scheglov self-assigned this Feb 10, 2020
@scheglov
Copy link
Contributor

dart-bot pushed a commit that referenced this issue Feb 10, 2020
Bug: #40482
Change-Id: Ifb65cd8016dca18c634cd216759278b7518d41ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135185
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead. NNBD Issues related to NNBD Release P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants