Bugfix of Iterable-returning methods on List - now returns correct type of Iterable.

33 views
Skip to first unread message

Lasse R.H. Nielsen

unread,
Jul 18, 2014, 4:10:46 AM7/18/14
to mi...@dartlang.org
Consider this a warning that if your program has a bug, it might get caught now.

I've committed, as r38372, a fix to (part of) a long standing bug on List, where the Iterable returned by "where", "skip", "take", "skipWhile", "takeWhile" and "reveresed", as well as the Map returned by "asMap", did not have the correct generic type.

On a List<E>, the "where" method is listed as returning "Iterable<E>", but it has actually been returning just an "Iterable<dynamic>". That's a safe approximation (hence the low priority on fixing it), but not what was really intended.

If your program is fully typed and has no warnings, or is completely untyped, then this should have no effect, but if such an Iterable object is assigned to a variable with the *wrong* generic type, and it avoids getting caught by static type checking, it will now be caught at runtime.

The VM's typed-data lists still suffer from the problem.

Cheers
/L
--
Lasse R.H. Nielsen - l...@google.com  
'Faith without judgement merely degrades the spirit divine'
Google Denmark ApS - Frederiksborggade 20B, 1 sal - 1360 København K - Denmark - CVR nr. 28 86 69 84
Reply all
Reply to author
Forward
0 new messages