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

Confusing inference for List<Object> foo = ['foo', 'bar'] #27586

Closed
jacob314 opened this issue Oct 13, 2016 · 5 comments
Closed

Confusing inference for List<Object> foo = ['foo', 'bar'] #27586

jacob314 opened this issue Oct 13, 2016 · 5 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on
Milestone

Comments

@jacob314
Copy link
Member

jacob314 commented Oct 13, 2016

List<Object> foo = ['foo', 'bar']

should result in foo having runtime type List<Object> not List<String>
This was broken in a recent dart dev compiler roll.

@jmesserly jmesserly added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-strong-mode P2 A bug or feature request we're likely to work on and removed web-dev-compiler labels Oct 17, 2016
@jmesserly jmesserly assigned jmesserly and unassigned leafpetersen Oct 17, 2016
@jmesserly
Copy link

Yeah we always prefer most precise type information (for better or worse). I chatted with Leaf earlier and will take a look at improving the inference, so it prefers downwards info. The tricky part to this is that we sometimes have imprecise downward info for nested generic methods, and we don't want those types to take priority.

@jmesserly
Copy link

related: #27625

@matanlurey
Copy link
Contributor

We hit a nasty instance of this internally (thanks @leafpetersen).

If this isn't fixed/addressed soon, I'd recommend clearly documenting this (as best you can) in the DDC usage/strong-mode guide - it was definitely very confusing (and the stack trace you get offers almost nothing to help fix it).

@leafpetersen
Copy link
Member

Cross referencing: #27933

@jmesserly
Copy link

If this isn't fixed/addressed soon, I'd recommend clearly documenting this (as best you can) in the DDC usage/strong-mode guide - it was definitely very confusing (and the stack trace you get offers almost nothing to help fix it).

Hi @matanlurey - can you explain what you mean by stack trace? If the compiler/analyzer threw an error that sounds like a different bug.

@jmesserly jmesserly added this to the 1.23 milestone Mar 6, 2017
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. P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

4 participants