@@ -718,27 +718,25 @@ public func < (lhs: AnyIndex, rhs: AnyIndex) -> Bool {
718
718
/// A protocol for `AnyCollection<Element>`,
719
719
/// `AnyBidirectionalCollection<Element>`, and
720
720
/// `AnyRandomAccessCollection<Element>`.
721
- ///
722
- /// This protocol can be considered an implementation detail of the
723
- /// `===` and `!==` implementations for these types.
724
721
public protocol AnyCollectionProtocol : Collection {
725
722
/// Identifies the underlying collection stored by `self`. Instances
726
723
/// copied from one another have the same `_underlyingCollectionID`.
727
724
var _underlyingCollectionID : ObjectIdentifier { get }
728
- }
729
725
730
- /// Returns `true` iff `lhs ` and `rhs` store the same underlying collection.
731
- public func === <
732
- L : AnyCollectionProtocol , R : AnyCollectionProtocol
733
- > ( lhs : L , rhs : R ) -> Bool {
734
- return lhs . _underlyingCollectionID == rhs . _underlyingCollectionID
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
735
731
}
736
732
737
- /// Returns `false` iff `lhs` and `rhs` store the same underlying collection.
738
- public func !== <
739
- L : AnyCollectionProtocol , R : AnyCollectionProtocol
740
- > ( lhs: L , rhs: R ) -> Bool {
741
- return lhs. _underlyingCollectionID != rhs. _underlyingCollectionID
733
+ extension AnyCollectionProtocol {
734
+ public // @testable
735
+ func _storesSameUnderlyingCollection<
736
+ C: AnyCollectionProtocol
737
+ > ( _ other: C ) -> Bool {
738
+ return _underlyingCollectionID == other. _underlyingCollectionID
739
+ }
742
740
}
743
741
744
742
% for ( ti, Traversal) in enumerate ( TRAVERSALS) :
@@ -1003,3 +1001,17 @@ public func anyGenerator<G : IteratorProtocol>(_ base: G) -> AnyIterator<G.Eleme
1003
1001
public func anyGenerator < Element > ( _ body: ( ) - > Element? ) - > AnyIterator< Element> {
1004
1002
Builtin . unreachable ( )
1005
1003
}
1004
+
1005
+ @available ( * , unavailable)
1006
+ public func === <
1007
+ L : AnyCollectionProtocol, R : AnyCollectionProtocol
1008
+ > ( lhs: L, rhs: R) - > Bool {
1009
+ Builtin . unreachable ( )
1010
+ }
1011
+
1012
+ @available( * , unavailable)
1013
+ public func !== <
1014
+ L : AnyCollectionProtocol, R : AnyCollectionProtocol
1015
+ > ( lhs: L, rhs: R) - > Bool {
1016
+ Builtin . unreachable ( )
1017
+ }
0 commit comments