mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 05:16:40 +00:00
c15f054809
The `EfficientLengthIterable` is an internal marker interface that allows the SDK to more efficiently check, effectively, `v is List || v is Set || v is Queue`, and some other known internal types, which allows it to assume that `.length` is efficient and doesn't iterate the iterable. It's not intended for external use, but the current design both has the name mentioned specifically in the declaration of the public types `List`, `Set` and `Queue`, and possibly allows the type to leak through the least-upper-bound algorithm. This change moves the mention of `EfficientLengthIterable` from the public types to an anonymously named private type, and ensures that the private type is never the result of a least-upper-bound computation, by adding another interface with the same depth that all the public types implementing `EfficientLengthIterable` also implement. (A longer term solution to `EfficientLengthIterable` looking like it's a public name could be combining the collection- related code from `dart:collection`, `dart:core` and `dart:_internal` into a single `dart:_collection_impl`, and exporting the relevant types from there. Then we could make the interface be `_EfficientLengthIterable` again.) Change-Id: I717743f0ca253782162be0ad9ff05036fdf57159 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322320 Reviewed-by: Nate Bosch <nbosch@google.com> Reviewed-by: Slava Egorov <vegorov@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com> Reviewed-by: Stephen Adams <sra@google.com> Commit-Queue: Lasse Nielsen <lrn@google.com> |
||
---|---|---|
.. | ||
async_cast.dart | ||
bytes_builder.dart | ||
cast.dart | ||
errors.dart | ||
internal.dart | ||
internal_sources.gni | ||
iterable.dart | ||
linked_list.dart | ||
list.dart | ||
lowering.dart | ||
patch.dart | ||
print.dart | ||
sort.dart | ||
symbol.dart |