@@ -715,28 +715,11 @@ public func < (lhs: AnyIndex, rhs: AnyIndex) -> Bool {
715
715
//===--- Collections ------------------------------------------------------===//
716
716
//===----------------------------------------------------------------------===//
717
717
718
- /// A protocol for `AnyCollection<Element>`,
719
- /// `AnyBidirectionalCollection<Element>`, and
720
- /// `AnyRandomAccessCollection<Element>`.
721
- public protocol AnyCollectionProtocol : Collection {
718
+ public // @testable
719
+ protocol _AnyCollectionProtocol : Collection {
722
720
/// Identifies the underlying collection stored by `self`. Instances
723
- /// copied from one another have the same `_underlyingCollectionID`.
724
- var _underlyingCollectionID : ObjectIdentifier { get }
725
-
726
- /// Returns `true` iff `self` and `other` use the same `_box` to store their
727
- /// underlying collections.
728
- func _storesSameUnderlyingCollection<
729
- C: AnyCollectionProtocol
730
- > ( _ other: C ) -> Bool
731
- }
732
-
733
- extension AnyCollectionProtocol {
734
- public // @testable
735
- func _storesSameUnderlyingCollection<
736
- C: AnyCollectionProtocol
737
- > ( _ other: C ) -> Bool {
738
- return _underlyingCollectionID == other. _underlyingCollectionID
739
- }
721
+ /// copied or upgraded/downgraded from one another have the same `_boxID`.
722
+ var _boxID : ObjectIdentifier { get }
740
723
}
741
724
742
725
% for ( ti, Traversal) in enumerate ( TRAVERSALS) :
@@ -751,7 +734,7 @@ extension AnyCollectionProtocol {
751
734
///
752
735
/// - SeeAlso: ${', '.join('`Any%sCollection`' % t for t in (2 * TRAVERSALS)[ti + 1 : ti + 3]) }
753
736
public struct ${ Self} < Element>
754
- : AnyCollectionProtocol , ${ SelfProtocol} {
737
+ : _AnyCollectionProtocol , ${ SelfProtocol} {
755
738
756
739
internal init( _box: _ ${ Self} Box< Element> ) {
757
740
self . _box = _box
@@ -948,7 +931,7 @@ public struct ${Self}<Element>
948
931
949
932
/// Uniquely identifies the stored underlying collection.
950
933
public // Due to language limitations only
951
- var _underlyingCollectionID : ObjectIdentifier {
934
+ var _boxID : ObjectIdentifier {
952
935
return ObjectIdentifier ( _box)
953
936
}
954
937
@@ -976,10 +959,13 @@ extension Any${Kind} {
976
959
}
977
960
% end
978
961
979
- @available ( * , unavailable, renamed: " AnyCollectionProtocol " )
980
- public typealias AnyCollectionType = AnyCollectionProtocol
962
+ @available ( * , unavailable, renamed: " _AnyCollectionProtocol " )
963
+ public typealias AnyCollectionType = _AnyCollectionProtocol
964
+
965
+ @available ( * , unavailable, renamed: " _AnyCollectionProtocol " )
966
+ public typealias AnyCollectionProtocol = _AnyCollectionProtocol
981
967
982
- extension AnyCollectionProtocol {
968
+ extension _AnyCollectionProtocol {
983
969
@available ( * , unavailable, renamed: " makeIterator() " )
984
970
public func generate( ) -> AnyIterator < Iterator . Element > {
985
971
Builtin . unreachable ( )
@@ -1004,14 +990,14 @@ public func anyGenerator<Element>(_ body: () -> Element?) -> AnyIterator<Element
1004
990
1005
991
@available ( * , unavailable)
1006
992
public func === <
1007
- L : AnyCollectionProtocol , R : AnyCollectionProtocol
993
+ L : _AnyCollectionProtocol , R : _AnyCollectionProtocol
1008
994
> ( lhs: L, rhs: R) - > Bool {
1009
995
Builtin . unreachable ( )
1010
996
}
1011
997
1012
998
@available( * , unavailable)
1013
999
public func !== <
1014
- L : AnyCollectionProtocol , R : AnyCollectionProtocol
1000
+ L : _AnyCollectionProtocol , R : _AnyCollectionProtocol
1015
1001
> ( lhs: L, rhs: R) - > Bool {
1016
1002
Builtin . unreachable ( )
1017
1003
}
0 commit comments