dart-sdk/sdk/lib/internal
Lasse R.H. Nielsen c15f054809 Hide the existence of EfficientLengthIterable better.
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>
2023-09-12 11:08:42 +00:00
..
async_cast.dart [Core Libraries] Eliminate the fork in the core libraries. 2020-06-16 23:37:36 +00:00
bytes_builder.dart Add class modifiers to dart:_internal. 2023-03-20 13:16:06 +00:00
cast.dart Hide the existence of EfficientLengthIterable better. 2023-09-12 11:08:42 +00:00
errors.dart Remove LateInitializationError. 2021-01-12 20:21:33 +00:00
internal.dart [cfe] Check @patch annotations 2023-06-13 07:27:08 +00:00
internal_sources.gni [cfe] Add support for using backend defined sentinels in late lowering 2020-09-23 08:07:26 +00:00
iterable.dart Hide the existence of EfficientLengthIterable better. 2023-09-12 11:08:42 +00:00
linked_list.dart Make Iterable be the default implementation of itself. 2023-04-04 21:45:19 +00:00
list.dart Add more class modifiers to dart:collection. 2023-04-04 10:39:48 +00:00
lowering.dart [cfe] Add support for using backend defined sentinels in late lowering 2020-09-23 08:07:26 +00:00
patch.dart Make internal/patch.part a part of dart:_internal 2022-09-29 11:52:37 +00:00
print.dart [Core Libraries] Eliminate the fork in the core libraries. 2020-06-16 23:37:36 +00:00
sort.dart Spelling sdk 2022-12-19 22:31:18 +00:00
symbol.dart Clean up unused internal Symbol API. 2021-07-26 17:49:06 +00:00