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

Comments

@jacob314
Copy link
Member

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

This comment has been minimized.

Copy link
Contributor

commented Oct 17, 2016

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

This comment has been minimized.

Copy link
Contributor

commented Oct 20, 2016

related: #27625

jmesserly added a commit that referenced this issue Nov 30, 2016
jmesserly added a commit that referenced this issue Nov 30, 2016
@matanlurey

This comment has been minimized.

Copy link
Contributor

commented Dec 22, 2016

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

This comment has been minimized.

Copy link
Member

commented Dec 22, 2016

Cross referencing: #27933

@jmesserly

This comment has been minimized.

Copy link
Contributor

commented Jan 4, 2017

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

@jmesserly jmesserly closed this in f021a70 Mar 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.