Closed
Description
On the following code:
void fn(Iterable iter) {}
void main() {
bool condition = true;
Iterable<String> iter = [];
fn(condition ? [] : iter.toList());
}
The analyzer reports the following warning:
[warning] The argument type 'EfficientLength' cannot be assigned to the parameter type 'Iterable'
This seems wrong. The first branch of the ternary operator is a List
, which is assignable to Iterable
.
Note that if <String>
is removed from the type annotation for iter
, or if <String>
is added to the list literal, the warning goes away.
I'm using 1.13.0-edge.9e18a7519d429f87c70bb3b8871c6cc666ee3fa6.