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

Analyzer detection of block-bodied functions in type inference is incomplete. #31963

Closed
stereotype441 opened this issue Jan 22, 2018 · 0 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.

Comments

@stereotype441
Copy link
Member

The analyzer contains a hint, TOP_LEVEL_FUNCTION_LITERAL_BLOCK, to let the user know that type inference results may not be reliable due to the appearance of a block-bodied function in a variable's initializer. (The common front end can type infer such variables accurately; the analyzer can't always).

Unfortunately, this hint does not always fire correctly. For example, the following code currently should produce the hint, but it doesn't:

T f<T>(T Function() g) => g();
var y = f(() { return 0; });

I'm working on a fix.

@stereotype441 stereotype441 added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-strong-mode labels Jan 22, 2018
@stereotype441 stereotype441 self-assigned this Jan 22, 2018
stereotype441 added a commit to dart-lang/test that referenced this issue Jan 22, 2018
stereotype441 added a commit to dart-lang/test that referenced this issue Jan 22, 2018
@whesse whesse closed this as completed in 68fd556 Jan 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Projects
None yet
Development

No branches or pull requests

1 participant