Skip to content

Commit acb5399

Browse files
committed
Actually fix existentials no really
1 parent e574a11 commit acb5399

File tree

1 file changed

+35
-21
lines changed

1 file changed

+35
-21
lines changed

stdlib/public/core/ExistentialCollection.swift.gyb

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -728,14 +728,47 @@ extension AnySequence: Sequence {
728728
extension Any${Kind} {
729729
% if Kind == 'Sequence':
730730
/// Returns an iterator over the elements of this sequence.
731+
@inline(__always)
732+
@inlinable
733+
public __consuming func makeIterator() -> Iterator {
734+
return _box._makeIterator()
735+
}
736+
@inlinable
737+
public __consuming func dropLast(_ n: Int = 1) -> [Element] {
738+
return _box._dropLast(n)
739+
}
740+
@inlinable
741+
public __consuming func prefix(
742+
while predicate: (Element) throws -> Bool
743+
) rethrows -> [Element] {
744+
return try _box._prefix(while: predicate)
745+
}
746+
@inlinable
747+
public __consuming func suffix(_ maxLength: Int) -> [Element] {
748+
return _box._suffix(maxLength)
749+
}
731750
% else:
732751
/// Returns an iterator over the elements of this collection.
733-
% end
734752
@inline(__always)
735753
@inlinable
736754
public __consuming func makeIterator() -> Iterator {
737755
return _box._makeIterator()
738756
}
757+
@inlinable
758+
public __consuming func dropLast(_ n: Int = 1) -> Any${Kind}<Element> {
759+
return Any${Kind}(_box: _box._dropLast(n))
760+
}
761+
@inlinable
762+
public __consuming func prefix(
763+
while predicate: (Element) throws -> Bool
764+
) rethrows -> Any${Kind}<Element> {
765+
return try Any${Kind}(_box: _box._prefix(while: predicate))
766+
}
767+
@inlinable
768+
public __consuming func suffix(_ maxLength: Int) -> Any${Kind}<Element> {
769+
return Any${Kind}(_box: _box._suffix(maxLength))
770+
}
771+
% end
739772

740773
@inlinable
741774
public var underestimatedCount: Int {
@@ -763,7 +796,6 @@ extension Any${Kind} {
763796
return try _box._forEach(body)
764797
}
765798

766-
/*
767799
@inlinable
768800
public __consuming func drop(
769801
while predicate: (Element) throws -> Bool
@@ -772,33 +804,15 @@ extension Any${Kind} {
772804
}
773805

774806
@inlinable
775-
public __consuming func dropFirst(_ n: Int) -> Any${Kind}<Element> {
807+
public __consuming func dropFirst(_ n: Int = 1) -> Any${Kind}<Element> {
776808
return Any${Kind}(_box: _box._dropFirst(n))
777809
}
778810

779-
@inlinable
780-
public __consuming func dropLast(_ n: Int) -> Any${Kind}<Element> {
781-
return Any${Kind}(_box: _box._dropLast(n))
782-
}
783-
784-
@inlinable
785-
public __consuming func prefix(
786-
while predicate: (Element) throws -> Bool
787-
) rethrows -> Any${Kind}<Element> {
788-
return try Any${Kind}(_box: _box._prefix(while: predicate))
789-
}
790-
791811
@inlinable
792812
public __consuming func prefix(_ maxLength: Int) -> Any${Kind}<Element> {
793813
return Any${Kind}(_box: _box._prefix(maxLength))
794814
}
795815

796-
@inlinable
797-
public __consuming func suffix(_ maxLength: Int) -> Any${Kind}<Element> {
798-
return Any${Kind}(_box: _box._suffix(maxLength))
799-
}
800-
*/
801-
802816
@inlinable
803817
public func _customContainsEquatableElement(
804818
_ element: Element

0 commit comments

Comments
 (0)