Karoy Lorentey
3ba8d70ec3
Review and update container protocols and conformances
...
- @inlinable → @_alwaysEmitIntoClient for now, to avoid temporary ABI issues
- Review RangeReplaceableContainer algorithms; add missing ones:
- New requirements: `removeFirst()`, `removeFirst(_:)`, `_customRemoveLast()`, `_customRemoveLast(_:) (with default implementations)
- `func removeAll()`
- `func removeLast()`, `func removeLast(_:)`, `func popLast()` when self is also bidirectional
- Review RigidArray, UniqueArray algorithms; remove ones needlessly duplicating functionality already provided by RRC. Try not to break source compatibility.
2026-07-07 14:18:09 -07:00
Karoy Lorentey
204e94cb63
[ContainersPreview] Conform span types to some of the container protocols
...
This is currently limited to `Container`, `BidirectionalContainer`, `RandomAccessContainer` and `MutableContainer`. `OutputSpan` and `InputSpan` should also be `RangeReplaceableContainer`s, but that is proving tricky to express in current Swift.
2026-07-07 14:18:09 -07:00
Karoy Lorentey
8a1438c2b2
[ContainersPreview] Update/fix RangeReplaceableContainer
...
- Introduce easy-to-use `replace(removing:addingFrom:)`, `insert(from:at:)`, and `append(from:)` algorithms that take `CountedProducer` instances, avoiding having to pass explicit counts separately
- Avoid RangeExpression2 helpers from satisfying core protocol requirements, leading to broken conformances
- Add `replace(removing:moving:)`, `replace(removing:consuming:)`, `insert(moving:at:)`, `insert(consuming:at:)`, `append(moving:)`, `append(consuming:)` operations that take range-replaceable containers.
- Reorder some parameters for consistency/readability:
- `insert(addingCount:at:from:)` → `insert(addingCount:from:at:)`
- `insert(at:moving:from:)` → `insert(moving:from:at:)`
2026-06-23 17:30:24 -07:00
Karoy Lorentey
b2c1669aa7
[ContainersPreview] RandomAccessContainer: Add a separate set of default implementations for Index == Int
...
This avoids going through Strideable, likely assisting the inliner.
Also mark default implementations @_aeic, to avoid ABI headaches
2026-06-23 17:07:25 -07:00
Karoy Lorentey
250af87308
[ContainersPreview] Redeclare Container requirements in refining protocols
...
Use `override`/`@_nonoverride` to help associated type inference and to allow diverging implementations of select requirements in BidirectionalContainer, RandomAccessContainer, and MutableContainer.
2026-06-23 16:55:53 -07:00
Karoy Lorentey
e8b09ade25
Add subscript requirements to [Mutable]Container with borrow/mutate accessors
2026-06-22 20:10:22 -07:00
Karoy Lorentey
22a94a9756
[ContainersPreview] Have RangeExpression2 refine RangeExpression
2026-06-18 15:31:37 -07:00
Karoy Lorentey
130d235b28
Resolve issues after rebase
2026-06-18 13:29:52 -07:00
Karoy Lorentey
12b1cf8020
[ContainersPreview] Make Drain refine CountedProducer
...
This lets us avoid having to pass an explicit count when using a drain to populate a container.
2026-06-18 13:22:16 -07:00
Karoy Lorentey
eabf5141d1
[ContainersPreview] Add CountedProducer protocol
2026-06-18 13:22:16 -07:00
Karoy Lorentey
de3b9b67be
[ContainersPreview] Move helpers to InternalCollectionsUtilities
2026-06-18 13:20:38 -07:00
Karoy Lorentey
3d68fc1107
Clean up the UniqueBox/Ref/MutableRef situation
...
- UniqueBox is public API, so we cannot remove it in favor of the stdlib’s
- Remove Ref and MutableRef. Keep an internal _MutableRef to work around stdlib limitations.
2026-06-17 18:29:41 -07:00
Karoy Lorentey
51c9e4ead8
Fix IterableIteratorProtocol.map; add map2 and map3 with different throwing behavior
2026-06-17 18:24:03 -07:00
Karoy Lorentey
7c853751c6
Add IterableIteratorProtocol.mapError
2026-06-17 18:24:03 -07:00
Karoy Lorentey
bced34defa
Review error handling
2026-06-17 18:24:03 -07:00
Karoy Lorentey
85cdb77d25
Fix build issues
2026-06-17 16:17:36 -07:00
Karoy Lorentey
816b887369
Update CMake and Xcode build configurations
2026-06-17 14:40:07 -07:00
Nate Cook
c039a18a0e
Switch to using stdlib Ref and UniqueBox
2026-06-17 14:27:29 -07:00
Nate Cook
dca015d7e8
Align Iterable with proposal
...
Adds throwing and ~Escapable elements
2026-06-17 14:27:29 -07:00
Nate Cook
4bda43f4a9
Renaming BorrowingSequence_ to Iterable_
2026-06-17 14:27:29 -07:00
Karoy Lorentey
e31c04143e
Update CMake & Xcode build configurations
2026-06-05 18:45:56 -07:00
Guoye Zhang
8cacd3c125
Add missing availability to Borrow
2026-05-18 17:50:20 -07:00
Franz Busch
f674e13c3d
Guard UniqueBox.borrow correctly
...
Correctly guard the `borrow` method behind the compiler version
2026-05-11 14:43:54 +02:00
Karoy Lorentey
16d6b8e1fe
[ContainersPreview] Inout ⟹ MutableRef
2026-05-06 18:28:07 -07:00
Karoy Lorentey
1fd366764d
[ContainersPreview] Ref: Fix fallback implementation; make sure we have deprecated aliases for old names
2026-05-06 18:00:13 -07:00
Karoy Lorentey
18c58bcca4
[ContainersPreview] Ref: Disable Builtin.Borrow for now
2026-05-06 18:00:13 -07:00
Karoy Lorentey
a6fd64697a
[ContainersPreview] Borrow ⟹ Ref
...
Also update the type’s public API surface to reflect SE-0519, leaving deprecated aliases for the old names.
2026-05-06 18:00:13 -07:00
Franz Busch
3c373b900c
Use the defines from traits directly
...
Package traits already pass defines with their trait name when building. Instead of adding our own conditional defines based on the traits we can use the trait provided defines directly. I observed that various tooling behaves better with the trait provided defines.
2026-05-06 07:41:02 -07:00
Karoy Lorentey
3a55ce888c
[ContainersPreview] UniqueBox.value: Avoid using borrow/mutate on old compilers
...
These (and `@_unsafeSelfDependentResult`) are only usable on 6.4 snapshots. As 6.4 hasn’t shipped yet, we need to also make these conditional on the UnstableContainersPreview trait.
2026-05-05 17:31:09 -07:00
Karoy Lorentey
146056a641
[ContainersPreview] Box ⟹ UniqueBox
...
Also update the type’s public API surface to reflect SE-0517, leaving deprecated aliases for the old names.
2026-05-05 17:31:05 -07:00
Karoy Lorentey
dd6dd8a445
[ContainersPreview] Clean up some notes
2026-05-01 15:13:45 -07:00
Karoy Lorentey
f652543a50
[ContainersPreview] Producer.ProducerError ⟹ Producer.Failure
...
Reserving a unique name for Producer’s failure type seems unwise, especially if we end up Producer refining a throwing BorrowingSequence protocol.
2026-04-30 13:31:28 -07:00
Karoy Lorentey
1c95e19aeb
[ContainersPreview] Don’t require Container.Index to conform to Comparable
...
This slows down the default implementations of `distance(from:to:)` and `index(_:offsetBy:limitedBy:)`, but it allows linked lists to conform to `Container`. The trade off seems fair.
While we’re here, flesh out the `BidirectionalContainer` refinements a little, and add `Container.isEmpty` and `._custom[Last]IndexOfEquatableElement(_:)`.
This code is still untested.
2026-04-16 18:04:37 -07:00
Karoy Lorentey
35b7d8fba4
Fix lifetime requirements rigidly enforced in the latest nightlies
2026-04-03 17:01:36 -07:00
Karoy Lorentey
495d96d27d
[ContainersPreview] Better illuminate the nextSpan problem on ContainerIterator
2026-04-03 09:01:48 -07:00
Karoy Lorentey
75b0309e12
Producer.skip(upTo:) → .skip(by:)
...
This is to align naming with BorrowingIteratorProtocol. The signatures are still different, as Producers may throw.
2026-03-27 11:52:05 -07:00
Karoy Lorentey
f83e9b6538
Rename Collection.underestimatedCount_
2026-03-27 11:47:00 -07:00
Karoy Lorentey
597b7a7dd2
Revert most of the availability constraints from 419e2f and 4c0482 🎉
2026-03-27 11:25:43 -07:00
Nate Cook
efdc1bbd96
Remove BorrowingSequence experimental feature flag
...
This prevents accidental usage of the experimental stdlib feature,
where the library's implementation is intended instead.
2026-03-27 10:56:44 -05:00
Nate Cook
a99a015934
Disambiguate ContainersPreview and stdlib
...
Adds trailing underscores to the BorrowingSequence protocols and
requirements, in order to allow both parallel conformances and
the ability to evolve the requirements in this package.
2026-03-27 07:41:32 -05:00
Karoy Lorentey
4c04822689
[ContainersPreview] Exhibit B in the case against prototyping things in the stdlib 😳
2026-03-26 18:13:22 -07:00
Karoy Lorentey
d2d3b917ca
[BasicContainers, ContainersPreview, DequeModule] More SuppressedAssociatedTypesWithDefaults fixups
2026-03-26 18:12:41 -07:00
Karoy Lorentey
419e2f7df2
[ContainersPreview] Exhibit A in the case against prototyping things in the stdlib 😞
2026-03-26 17:14:45 -07:00
Karoy Lorentey
3e380cb358
[ContainersPreview] Work around compiler crash
2026-03-26 17:14:44 -07:00
Karoy Lorentey
fa80d7c0d3
[ContainersPreview] Work around name lookup anomaly
2026-03-26 16:17:53 -07:00
Karoy Lorentey
a1acf5003b
[ContainersPreview] Make ConsumingMapProducer unconditionally nonescapable
2026-03-26 16:08:49 -07:00
Karoy Lorentey
13c5d9b480
[ContainersPreview] Avoid weird compiler(?) issue(?) with ConsumingFilterProducer’s conditional conformance to Escapable
2026-03-26 16:06:04 -07:00
Karoy Lorentey
eb708a9ba5
[ContainersPreview] Audit some protocol extensions for SuppressedAssociatedTypesWithDefaults
2026-03-26 16:05:07 -07:00
Karoy Lorentey
70a25f1f69
[ContainersPreview] Bump required toolchain to 6.4 for new protocols
2026-03-26 14:51:08 -07:00
Nate Cook
2eac7ce64d
Add tests for BorrowingSequence
...
With just enough algorithms (reduce, elementsEqual) to test.
2026-03-26 14:25:01 -05:00