Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Confusing inference for List<Object> foo = ['foo', 'bar'] #27586
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.
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).
Hi @matanlurey - can you explain what you mean by stack trace? If the compiler/analyzer threw an error that sounds like a different bug.