Skip to content

Commit b3030fc

Browse files
authored
Merge pull request #4691 from apple/stdlib-existential-collection-fix
stdlib: type-erased collections: add forwarding for '_customContainsEquatableElement()'
2 parents 72392e6 + ff4d282 commit b3030fc

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

stdlib/public/core/ExistentialCollection.swift.gyb

+6
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,12 @@ extension Any${Kind} {
667667
whereSeparator: isSeparator)
668668
}
669669

670+
public func _customContainsEquatableElement(
671+
_ element: Element
672+
) -> Bool? {
673+
return _box.__customContainsEquatableElement(element)
674+
}
675+
670676
public func _preprocessingPass<R>(
671677
_ preprocess: () throws -> R
672678
) rethrows -> R? {

validation-test/stdlib/ExistentialCollection.swift.gyb

+6-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ tests.test("AnySequence.init(() -> Generator)") {
135135
% MinimalBase = 'Minimal' + collectionForTraversal(Traversal)
136136
% end
137137

138-
tests.test("${TestedType}: dispatch to wrapped") {
138+
tests.test("${TestedType}: dispatch to wrapped, SequenceLog") {
139139
typealias Base = ${LoggingWrapper}<${MinimalBase}<OpaqueValue<Int>>>
140140
typealias Log = SequenceLog
141141
let base = Base(wrapping:
@@ -191,6 +191,10 @@ tests.test("${TestedType}: dispatch to wrapped") {
191191
_ = s.split { (_) in true }
192192
}
193193

194+
Log._customContainsEquatableElement.expectIncrement(Base.self) {
195+
_ = s._customContainsEquatableElement(OpaqueValue(42))
196+
}
197+
194198
Log._preprocessingPass.expectIncrement(Base.self) {
195199
_ = s._preprocessingPass {}
196200
}
@@ -210,7 +214,7 @@ tests.test("${TestedType}: dispatch to wrapped") {
210214
}
211215

212216
% if Traversal != 'Sequence':
213-
tests.test("${TestedType}: dispatch to wrapped") {
217+
tests.test("${TestedType}: dispatch to wrapped, CollectionLog") {
214218
typealias Base = ${LoggingWrapper}<${MinimalBase}<OpaqueValue<Int>>>
215219
typealias Log = CollectionLog
216220
let base = Base(wrapping:

0 commit comments

Comments
 (0)