Karoy Lorentey
cd0ca78dbd
[DequeModule] Assorted UniqueDeque doc string fixes
2026-04-27 18:10:26 -07:00
Karoy Lorentey
4225f78a2b
[DequeModule]: UniqueDeque.insert(addingCount:at:initializingWith:): Add empty shortcut
2026-04-27 18:01:24 -07:00
Karoy Lorentey
c068f8ccb7
[DequeModule] UniqueDeque replacements with Collections: Verify that the source’s count matches its contents
2026-04-27 18:01:24 -07:00
Karoy Lorentey
2c86775a6b
[DequeModule] UniqueDeque.replace(removing:addingCount:initializingWith:): Fix sizing issue
2026-04-27 18:01:24 -07:00
Karoy Lorentey
30f28dcdcb
[DequeModule] RigidDeque.consume(_:consumingWith:): Style nit: consume span explicitly
2026-04-27 18:01:24 -07:00
Karoy Lorentey
f5661c674a
[DequeModule] insert(addingCount:initializingWith:): Add shortcut for zero elements
2026-04-27 18:01:23 -07:00
Karoy Lorentey
285016b285
[DequeModule] RigidDeque replacements with Collections: Verify that the source’s count matches its contents
2026-04-27 18:01:23 -07:00
Karoy Lorentey
1d5418fb68
[DequeModule] RigidDeque.prepend(addingCount:initializingWith:): Add shortcut for zero elements
...
This was already present in the append variant; there is no reason not to do the same here.
2026-04-27 18:01:23 -07:00
Karoy Lorentey
5342399a18
[DequeModule] Fix small issues in doc strings
2026-04-27 18:01:23 -07:00
Karoy Lorentey
0be6f43972
[DequeModule] RigidDeque.nextMutableSpan(after:maximumCount:): Fix missing argument validation
2026-04-27 17:25:50 -07:00
Karoy Lorentey
654d57533f
[DequeModule] RigidDeque.consume(_:consumingWith:): Close resulting gap before returning
2026-04-27 17:18:05 -07:00
Karoy Lorentey
4b8dc6d951
BasicContainers] RigidDictionary.udateValue(forKey:with:): Fix undefined behavior on removals
2026-04-27 16:42:51 -07:00
Karoy Lorentey
5bd8ab095d
[BasicContainers] UniqueArray.replace(removing:copying): Fix overallocation issue
...
`UniqueArray.replace(removing:copying:)` overloads overestimated the amount of memory they need, sometimes leading to unnecessary reallocations. Fix this.
2026-04-22 16:23:15 -07:00
Karoy Lorentey
6ed215dcc2
Merge pull request #629 from lorentey/fix-fancy-rigidarray-replacement
...
[BasicContainers] RigidArray.replace(removing:consumingWith:addingCount:initializingWith:): Fix correctness issue with partial initialization
2026-04-22 16:10:13 -07:00
Karoy Lorentey
d8ace00d14
[BasicContainers] RigidArray.replace(removing:consumingWith:addingCount:initializingWith:): Fix correctness issue with partial initialization
...
The original code was invoking `_closeGap` with an incorrect size (from `append` rather than `replace`), leading to runtime traps and potential memory safety issues if the `resize` invocation ends up underfilling the container.
2026-04-22 15:32:55 -07:00
Karoy Lorentey
b75bd4ef01
[BasicContainers] RigidSet.insert(maximumCount:from:): Fix spurious capacity overflow caused by incorrect accounting
2026-04-22 15:12:55 -07:00
Karoy Lorentey
084be39d7e
[BitSet] Add makeIterator(from:)
...
This enables faster iteration over subranges of a BitSet than the `Slice` type’s default indexing iterator. (Depending on the fill factor, the speedup can be as high as 4x — not insignificant.)
2026-04-21 16:28:14 -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
9f0cf4be8b
Merge pull request #622 from thisismanan/ordered-set-neg-fix
...
OrderedSet: Don't crash on negative capacity values
2026-04-16 14:47:49 -07:00
Manan
396577ca27
OrderedSet: Don't crash on negative capacity values
...
Fixes https://github.com/apple/swift-collections/issues/608 , and starts behaving similar to Set()
2026-04-16 10:10:02 +05:30
Karoy Lorentey
bf8441dc95
[BasicContainers] Fix typos in doc comments
2026-04-08 18:31:11 -07:00
Karoy Lorentey
a9b64d4f09
[BasicContainers] RigidArray,UniqueArray: Add Equatable conformance on Swift 6.4
...
This is currently conditional on the UnstableContainersPreview trait. (Swift 6.4 has not shipped yet, so we cannot unconditionally enable this without risking breakage.)
2026-04-08 18:31:11 -07:00
Karoy Lorentey
917eead3cb
[BasicContainers] RigidArray,UniqueArray: Add FIXME for Custom[Debug]StringConvertible conformances
2026-04-08 18:31:11 -07:00
Karoy Lorentey
7f4cebd2c5
BasicContainers] Add UniqueArray.isTriviallyIdentical(to:)
2026-04-08 18:31:10 -07:00
Karoy Lorentey
b4bfd6d02e
[BasicContainers] RigidArray.isTriviallyIdentical(to:): Don’t require Equatable elements, but do allow noncopyable ones
2026-04-08 18:31:07 -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
e0ec6b0976
UniqueSet: Fix copypasta
2026-03-27 11:59:41 -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
685ef74751
Fix {Rigid,Unique}{Set,Dictionary}
2026-03-27 11:47:03 -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
61fb6f5d13
Fix errant CMakeList renamings
2026-03-27 11:02:44 -05: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
Nate Cook
a2cf230400
Align BorrowingSequence etc with proposal
...
This updates the ContainersPreview module to use the same
API as the proposed BorrowingSequence protocol and its supporting
types. In particular, instead of using Span as the iterator for
itself and other contiguously-stored types, this introduces
SpanIterator.
2026-03-26 14:25:01 -05:00
Karoy Lorentey
a8389f300a
[BasicContainers, DequeModule] Avoid defining new API in a point release
...
Stash them behind the UnstableContainersPreview package trait for now (making them non-public API).
2026-03-17 16:33:20 -07:00
Karoy Lorentey
8f88cce7c7
[BasicContainers, ContainersPreview] Make sure package traits “work” on 6.2 toolchains
...
“Work” in this case means that they can be enabled without breaking the build — not necessarily that all features are available.
Swift 6.2 is highly prone to runtime crashes in `swift_getTypeByMangledName` in generic code that uses ownership features. Swift 6.3 will resolve that.
2026-03-17 15:38:34 -07:00
Karoy Lorentey
3dc65340f3
[ContainersPreview] Fix support for Swift 6.2
2026-03-17 13:45:15 -07:00
Karoy Lorentey
2364daa6bf
[ContainersPreview] Update CMake & Xcode build files
2026-03-17 13:32:12 -07:00