Commit Graph
1780 Commits
Author SHA1 Message Date
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 c9b859dfda Don’t enable UnstableContainersPreview trait by default 2026-06-17 14:52:31 -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 232e6aeacf Merge pull request #667 from Azoy/setcapacity
[BasicContainers] Rename reallocate to setCapacity for Rigid and UniqueArray
2026-06-17 14:26:01 -07:00
Karoy Lorentey 9aca86f36b Update to reflect new name of expect{Rigid,Unique}ArrayContents 2026-06-17 13:58:54 -07:00
Karoy Lorentey 28e9d98a7e Fix deprecation warnings 2026-06-17 13:48:54 -07:00
Alejandro Alonso 06423d7329 Fix broken docs 2026-06-17 13:48:54 -07:00
Alejandro AlonsoandKaroy Lorentey 2a39308613 Update Sources/BasicContainers/UniqueArray/UniqueArray.swift
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2026-06-17 13:48:54 -07:00
Alejandro AlonsoandKaroy Lorentey eb5c24f71a Update Sources/BasicContainers/RigidArray/RigidArray.swift
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2026-06-17 13:48:54 -07:00
Alejandro AlonsoandKaroy Lorentey c6a1dabfd0 Update Sources/BasicContainers/RigidArray/RigidArray+Deprecated.swift
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2026-06-17 13:48:53 -07:00
Alejandro Alonso 6da58357a3 Rename reallocate to setCapacity for Rigid and UniqueArray
Update UniqueArray.swift

Update UniqueArray.swift
2026-06-17 13:48:53 -07:00
Karoy Lorentey af174fe447 Merge pull request #662 from sorinc03/fix/heap-node-tests-release
Run heap node tests in release
2026-06-09 15:03:37 -07:00
Karoy Lorentey a0cb0954ec Merge pull request #665 from lorentey/prerelease-cleanups
1.6.0 prerelease cleanups
1.6.0
2026-06-08 09:58:45 -07:00
Karoy Lorentey 9d0f2adb6b Update README 2026-06-05 18:50:16 -07:00
Karoy Lorentey f3ede2e378 Delete unused test source 2026-06-05 18:46:12 -07:00
Karoy Lorentey e31c04143e Update CMake & Xcode build configurations 2026-06-05 18:45:56 -07:00
Karoy Lorentey 5c8d97dccb Merge pull request #660 from apple/dn/ordered-set-move
[OrderedCollections] Add move operations
2026-06-05 17:45:16 -07:00
David Nadoba 72f074a23a [OrderedCollections] Use pre-removal destination index for move APIs 2026-06-05 17:05:03 -07:00
David Nadoba 5a6af29d55 [OrderedCollections] Refine move APIs and simplify no-op check 2026-06-05 14:44:22 -07:00
David Nadoba a83773321e [OrderedCollections] Rework move APIs and extend to OrderedDictionary
Reworks the relocation API and extends it to `OrderedDictionary`:

* Renames the index-range move to `moveSubrange(_:to:)` (with a
  `RangeExpression` overload) and the by-value move to `move(contentsOf:to:)`,
  matching the conventions of `removeSubrange`/`insert(_:at:)`. Adds
  `move(fromIndices:to:)`, which takes the source indices directly.
* Factors the element rearrangement into generic
  `UnsafeMutableBufferPointer` operations (rotation / rotation+permutation /
  scatter) so `OrderedDictionary` relocates its keys and values in lockstep
  through the same code, adding only the parallel value move; the hash-table
  maintenance stays entirely in `OrderedSet`.
* The hot path runs in O(*d* + *k*) and falls back to O(`count`) for large
  moves; bucket maintenance chooses targeted updates or a full rebuild by the
  same threshold.
* `move(contentsOf:to:)` ignores elements/keys that aren't present; duplicate
  members are detected and trap.

Adds tests (exhaustive hash-table integrity, value alignment under lifetime
tracking) and move benchmarks for both types.
2026-06-04 22:33:54 -07:00
Sorin Cioban bdd6b79403 Use package access for heap test helper 2026-06-04 10:18:09 +01:00
Karoy Lorentey 9ade2f7ba3 Merge pull request #664 from lorentey/benchmark-updates
Small benchmarking improvements
2026-06-02 18:13:55 -07:00
Karoy Lorentey c86ed20fc1 [Benchmark] Shareable(Set|Dictionary)Benchmarks → Tree$1Benchmarks 2026-06-02 17:57:49 -07:00
Karoy Lorentey b78086e6df [Benchmark] Resolve warnings under Swift 6.4 2026-06-02 17:48:22 -07:00
Karoy Lorentey 7a32c7582b [Benchmark] Enable sorted collection benchmarks, conditional on UnstableSortedCollections 2026-06-02 17:48:04 -07:00
Karoy Lorentey 346ab74f17 [Benchmark] Properly declare module dependencies 2026-06-02 17:47:14 -07:00
Karoy Lorentey 7220421ea8 [Benchmark] Define forwarding traits for swift-collections options 2026-06-02 17:46:53 -07:00
Karoy Lorentey 76f3560f3f [Benchmark] ENABLE_RUST_BENCHMARKS → EnableRustBenchmarks 2026-06-02 17:43:37 -07:00
Karoy Lorentey 0e46e9ba55 Merge pull request #661 from adityasingh2400/fix-issue-257
[SortedCollections] Fix _BTree default node capacity capping at 16
2026-06-02 17:04:51 -07:00
Sorin Cioban 49887191bb Run heap node tests in release 2026-05-31 23:10:33 +01:00
Aditya Singh ce67d512d5 [SortedCollections] Fix _BTree default node capacity capping at 16
The defaultInternalCapacity and defaultLeafCapacity computations used
Swift.min(16, capacityInBytes / MemoryLayout<Key>.stride), which capped
the node capacity at 16 regardless of element size. This defeated the
byte-budget intent: small elements should yield larger nodes, not be
clamped to 16. Use Swift.max instead so 16 acts as a floor and the
byte budget governs the upper bound, as confirmed by the maintainer
in issue #257.

Fixes #257
2026-05-29 00:52:15 -07:00
Karoy Lorentey cef9727051 Merge pull request #659 from adityasingh2400/fix-unsafe-buffer-trim
[InternalCollectionsUtilities] Fix _trim returning the wrong buffer region
2026-05-26 17:00:10 -07:00
David Nadoba 508f36f48d [OrderedSet] Add move(_:toOffset:)
Adds two overloads for relocating elements within an `OrderedSet`: one
taking a contiguous `Range<Int>`, and one taking a `Sequence<Element>`.
The moved elements occupy consecutive positions starting at the
destination, in the order they appear in the input.

The hot path runs in O(*d* + *k*) time, where *d* is the distance moved
and *k* is the number of elements moved; the implementation falls back
to O(`count`) for large moves.
2026-05-25 23:01:28 -07:00
Aditya Singh 0a3dcfd3a8 [InternalCollectionsUtilities] Fix _trim returning the wrong buffer region
The `_trim(first:)` and `_trim(last:)` helpers reassign `self` to the
remaining slice and then build the trimmed result from `self`'s now-updated
`baseAddress`/`count`, so they hand back a region that points into the wrong
place in the buffer.

`UnsafeMutableBufferPointer._trim(first:)` had this exact bug fixed earlier (it
captures `oldStart` before the reassignment), but three sibling helpers were
left untouched:

  * `UnsafeBufferPointer._trim(first:)` reads `baseAddress` after advancing
    `self`, so the returned prefix starts at the remainder instead of at the
    original head.
  * `UnsafeBufferPointer._trim(last:)` and
    `UnsafeMutableBufferPointer._trim(last:)` recompute `count &- cut` after
    shrinking `self`, so the returned suffix starts `cut` elements too early.

For a five-element buffer, `_trim(first: 2)` returned the bytes of `[30, 40]`
rather than `[10, 20]`, and `_trim(last: 2)` returned `[20, 30]` rather than
`[40, 50]`; trimming more than the count walked off the end of the buffer.

Capture the original start (and, for the suffix case, the post-trim count)
before mutating `self`, matching the already-correct `_trim(first:)` on the
mutable buffer. Adds direct tests covering both overloads on both buffer types.
2026-05-24 18:22:45 -07:00
Karoy Lorentey 9c02ebb097 Merge pull request #655 from apple/borrow-availability
Add missing availability to Borrow
2026-05-21 11:13:14 -07:00
Guoye Zhang 8cacd3c125 Add missing availability to Borrow 2026-05-18 17:50:20 -07:00
Karoy Lorentey fea17c02d7 Merge pull request #654 from lorentey/adjust-reexports
Resolve source break in the Collections module
1.5.1
2026-05-15 17:19:31 -07:00
Karoy Lorentey 1b3ec29d61 [Collections] Declare generic arguments on forwarding typealiases
Otherwise the typealiases do not work as intended on public API that mentions them in client modules.
2026-05-15 17:02:45 -07:00
Karoy Lorentey c3ba833517 Add basic tests for Collections module 2026-05-15 16:57:22 -07:00
Karoy Lorentey de84ac97fe Merge pull request #650 from lorentey/disable-formatter-on-wasm
[BasicContainers] Don’t define LLDB formatter symbol on Wasm
2026-05-15 10:53:12 -07:00
Karoy Lorentey a731a7fdad [BasicContainers] Don’t define LLDB formatter symbol on Wasm
While we’re here, follow our explicit access control rule when defining the variable.
2026-05-12 15:33:22 -07:00
Karoy Lorentey 7b371ce850 Merge pull request #649 from apple/fb-unique-box-borrow
Guard `UniqueBox.borrow` correctly
2026-05-11 18:36:53 -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 03cc312c2c Merge pull request #647 from lorentey/work/release-prep
1.5.0 release preparations
1.5.0
2026-05-07 16:47:02 -07:00
Karoy Lorentey 599e65addc Silence bogus license checker error for the FormatterFixtures package manifest 2026-05-07 16:32:38 -07:00