Commit Graph
2128 Commits
Author SHA1 Message Date
Tolga Unal 68fd4f2cc8 [DequeModule] Make UniqueDeque Iterable without ContainersPreview
842f125c removed the trait conditions around the Iterable APIs, but
UniqueDeque only got its conformance through Container in ContainersPreview.
RigidDeque had no underestimatedCount, so it was 0 through Iterable.
2026-11-05 09:09:48 -05:00
Karoy Lorentey ed857ee877 Merge pull request #826 from charles-zablit/cz/cmake/cmp0157
[CMake] Enable CMP0157 and keep whole-module builds for optimized configs
2026-11-04 16:50:34 -08:00
Charles Zablit 322b78cb8d [CMake] Enable CMP0157 and keep whole-module builds for optimized configs 2026-11-04 18:31:52 +00:00
Karoy Lorentey 1233c97689 Merge pull request #790 from Joseph-Cursio/fix-764-span-navigation
Add checkBidirectionalContainer and checkMutableContainer
2026-11-03 14:59:13 -08:00
e7d8cd2203 [ContainersPreview] Fix append(copying:) recursion and wrapped insert(copying:at:) (#819)
* [ContainersPreview] Fix append(copying:) recursion and wrapped insert(copying:at:)

The RangeReplaceableContainer extension's append(copying:) passed a
contiguous source's buffer back to itself and never returned.
_insertCollection copied the whole buffer on every initializer call, which
trapped when a deque's gap wrapped around the end of its storage. Copy only
what fits on each call, as replaceSubrange(_:copying:) already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Delete Tests/DequeTests/RangeReplaceableContainerCopyingTests.swift

Let's drop the tests for now; we'll need a less involved way to exercise such algorithms.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2026-11-03 14:57:43 -08:00
Karoy Lorentey 5bb5daddbb Merge pull request #807 from SwastikTripathi/docs-examples
Fix doc comment examples in OrderedDictionary, BitArray and SortedDictionary
2026-11-03 14:22:34 -08:00
Karoy Lorentey 9d026ae383 Merge pull request #808 from HuzaifaChaudary/fix/bitarray-wide-signed-conversion
[BitCollections] sign extend BitArray conversions to integers wider than a word
2026-11-03 14:22:18 -08:00
Karoy Lorentey a8b9b249a8 Merge pull request #818 from SwastikTripathi/fix/sorted-remove-at-rebalance
[SortedCollections] Balance the child after remove(at:)
2026-11-03 14:16:32 -08:00
Karoy Lorentey 6898f62dd0 Merge pull request #820 from Manishram-ai/fix-readme-links
Fix broken links in README and Container-design.md
2026-11-03 14:16:04 -08:00
Karoy Lorentey 958b16fb02 Merge pull request #821 from d-date/unique-deque-checked-sendable
Make UniqueDeque's Sendable conformance checked
2026-11-03 14:15:47 -08:00
Daiki Matsudate 16710713be Make UniqueDeque's Sendable conformance checked
UniqueDeque's only stored property is RigidDeque<Element>, which is
already Sendable when Element is, so the compiler can verify the
conformance without @unchecked. This mirrors UniqueArray over RigidArray.
2026-11-02 16:56:23 +09:00
Manish Ram c2886d53ee Fix broken links in README and Container-design.md 2026-11-01 15:03:15 -08:00
Swastik TripathiandClaude Opus 5.5 93745231f1 [SortedCollections] Balance the child after remove(at:)
remove(at:) recursed into the child holding the offset and returned
without balancing it, so repeated removals could empty a leaf. Iterating
then read a stale slot, which returned already-removed elements and read
released references in release builds, and trapped in debug builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 09:43:22 +05:30
HuzaifaChaudary ed61a95cc8 [BitCollections] sign extend BitArray conversions to integers wider than a word
converting a negative bit array to `Int128` lost the sign above the first
64 bits , so `Int128(truncatingIfNeeded: "1" as BitArray)` gave
18446744073709551615 , not -1 , `Int128(exactly:)` gave nil , and
`Int128(_:)` trapped . a negative value now starts out as all ones , so the
words shifted in keep the sign .

the trap message also named `BitArray` as the type it could not convert
to , it names the integer type now .
2026-10-30 20:22:20 +05:00
Swastik TripathiandClaude Opus 5.5 8da3cafe2e Fix doc comment examples in OrderedDictionary, BitArray and SortedDictionary
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 09:04:13 +05:30
Joseph CursioandClaude Opus 5.5 bdddf6dba8 Check UniqueDeque with checkMutableContainer
Run the mutable container checker, which also runs the bidirectional
one, against UniqueDeque over every storage layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 04:51:50 -05:00
Joseph CursioandClaude Opus 5.5 6ed61375a6 Check RigidDeque with checkMutableContainer
Run the mutable container checker, which also runs the bidirectional
one, against RigidDeque over every storage layout. With #793's
spanBoundary fix reverted, it fails with a negated distance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 04:51:50 -05:00
Joseph CursioandClaude Opus 5.5 d1f377cb2d Check UniqueArray with checkMutableContainer
Run the mutable container checker, which also runs the bidirectional
one, against UniqueArray.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 04:51:50 -05:00
Joseph CursioandClaude Opus 5.5 bfc228d7b7 Check RigidArray with checkMutableContainer
Run the mutable container checker, which also runs the bidirectional
one, against RigidArray. With #793's nextMutableSpan fix reverted, it
fails with the index not advancing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 04:51:50 -05:00
Joseph CursioandClaude Opus 5.5 2d14dcdff9 Check MinimalBidirectionalContainer with checkBidirectionalContainer
Run the bidirectional container checker against BidirectionalContainer's
default implementations. With #793's formIndex(_:offsetBy:limitedBy:)
fix reverted, it fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 04:51:50 -05:00
Joseph CursioandClaude Opus 5.5 3d196ae9bd Add MinimalBidirectionalContainer to the test support library
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 04:51:50 -05:00
Joseph CursioandClaude Opus 5.5 bc6be7189f Add checkMutableContainer
Check that nextMutableSpan and previousMutableSpan, with and without
maxCount and a limit, return the expected span from every index, move
the index past it, and write through to exactly those elements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 04:51:50 -05:00
Joseph CursioandClaude Opus 5.5 5200f52956 Add checkBidirectionalContainer
Check a BidirectionalContainer's backward navigation against its forward
navigation: index(before:), spanBoundary(before:) and previousSpan(before:)
with and without maxDistance or maxCount and a limit, negative offsets and
distances, and formIndex(_:offsetBy:limitedBy:) in both directions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 04:51:50 -05:00
Karoy Lorentey f96b909e1a Review RigidDeque/UniqueDeque tests; add better tests for prepends (#806) 1.7.5 2026-10-26 18:20:51 -07:00
Karoy Lorentey e13f175180 Review RigidDeque/UniqueDeque tests; add better tests for prepends 2026-10-26 18:01:57 -07:00
Awais Rehman d45bd52372 Merge pull request #796 from awaisdev5765/fix-prepend-multi-span
Fix prepend(copying:) dropping items from multi-span sources
2026-10-26 12:40:35 -07:00
Karoy Lorentey a06a685e32 Merge pull request #801 from aashish254/hunt-doc-examples
[DequeModule] Fix RigidDeque prepend example capacity and direction-word slips
2026-10-26 12:02:22 -07:00
Karoy Lorentey 37eaa97309 Merge pull request #800 from 0xSixtos/docs/macos-backdeployment
Document standalone macOS backdeployment requirements
2026-10-26 12:00:31 -07:00
Karoy Lorentey 99a77991c8 Merge pull request #804 from apple/dependabot/github_actions/swiftlang/github-workflows/dot-github/workflows/soundness.yml-0.0.17
Bump swiftlang/github-workflows/.github/workflows/soundness.yml from 0.0.16 to 0.0.17
2026-10-26 11:59:42 -07:00
Karoy Lorentey a35957e0a1 Merge pull request #803 from apple/dependabot/github_actions/swiftlang/github-workflows/dot-github/workflows/swift_package_test.yml-0.0.17
Bump swiftlang/github-workflows/.github/workflows/swift_package_test.yml from 0.0.16 to 0.0.17
2026-10-26 11:59:22 -07:00
Karoy Lorentey b5f8f813e3 Merge pull request #802 from apple/dependabot/github_actions/swiftlang/github-workflows-0.0.17
Bump swiftlang/github-workflows from 0.0.16 to 0.0.17
2026-10-26 11:58:15 -07:00
Karoy Lorentey 5f513e3e93 [OrderedCollections] Resolve filename ambiguity with InternalCollectionsUtilities/UnsafeBitSet/_UnsafeBitSet.swift (#805)
This only affects some build setups using the single-module configuration on
case-insensitive filesystems, but let’s get rid of it anyway.
2026-10-26 11:57:43 -07:00
Karoy Lorentey 93b0a28178 [OrderedCollections] Resolve filename ambiguity with InternalCollectionsUtilities/UnsafeBitSet/_UnsafeBitSet.swift
This only affects some build setups using the single-module configuration on
case-insensitive filesystems, but let’s get rid of it anyway.
2026-10-26 11:37:41 -07:00
dependabot[bot] 31da70a975 Bump swiftlang/github-workflows/.github/workflows/soundness.yml
Bumps [swiftlang/github-workflows/.github/workflows/soundness.yml](https://github.com/swiftlang/github-workflows) from 0.0.16 to 0.0.17.
- [Release notes](https://github.com/swiftlang/github-workflows/releases)
- [Commits](https://github.com/swiftlang/github-workflows/compare/0.0.16...0.0.17)

---
updated-dependencies:
- dependency-name: swiftlang/github-workflows/.github/workflows/soundness.yml
  dependency-version: 0.0.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-26 06:11:00 +00:00
dependabot[bot] cdc40a998c Bump swiftlang/github-workflows/.github/workflows/swift_package_test.yml
Bumps [swiftlang/github-workflows/.github/workflows/swift_package_test.yml](https://github.com/swiftlang/github-workflows) from 0.0.16 to 0.0.17.
- [Release notes](https://github.com/swiftlang/github-workflows/releases)
- [Commits](https://github.com/swiftlang/github-workflows/compare/0.0.16...0.0.17)

---
updated-dependencies:
- dependency-name: swiftlang/github-workflows/.github/workflows/swift_package_test.yml
  dependency-version: 0.0.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-26 06:10:23 +00:00
dependabot[bot] ca5f002d44 Bump swiftlang/github-workflows from 0.0.16 to 0.0.17
Bumps [swiftlang/github-workflows](https://github.com/swiftlang/github-workflows) from 0.0.16 to 0.0.17.
- [Release notes](https://github.com/swiftlang/github-workflows/releases)
- [Commits](https://github.com/swiftlang/github-workflows/compare/0.0.16...0.0.17)

---
updated-dependencies:
- dependency-name: swiftlang/github-workflows
  dependency-version: 0.0.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-26 06:10:19 +00:00
Aashish d04fe0cd79 Fix DequeModule doc comments: capacity-overflow example and prepend/append direction wording
The prepend(copying:) examples on RigidDeque build a capacity-10 deque and then insert 11 items, which traps with 'RigidDeque capacity overflow' -- the type never grows and the docs' own fixed-capacity section says a full deque traps. Capacity 11 holds the documented result. Also fix five copy-paste direction errors in prose summaries (append described as going to the front, prepend described as going to the end).
2026-10-23 16:45:05 +05:45
Sixtos 42446a969f Document standalone macOS backdeployment requirements 2026-10-22 23:41:01 -06:00
844289ac45 fix: guard InputSpan methods against nil base address in debug builds (#795)
* [BorrowingMapProducer] Fix skip(by:) hanging at end of iterator

When a BorrowingMapProducer's Failure is not Never, skip(by:) drove a
loop over nextSpan calls. Once the base iterator was exhausted,
nextSpan kept returning an empty span (count == 0), so the counter
never decremented and the loop ran forever.

Add a guard that exits the loop when the span is empty, matching the
skip(by:) contract: return with the remaining count when the iterator
runs out of elements before n reaches 0.

Adds a regression test that builds a RigidArray from a
mapError+map chain. RigidArray.init(capacity:from:) calls _expectEnd,
which exercises exactly the exhausted-iterator code path.

Fixes #773

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: guard InputSpan methods against nil base address in debug builds

removeFirst(_:), prepend(repeating:count:), and consumePrefix(upTo:) each
call _unsafeRawAddressOfSlot(uncheckedOffset:) before checking whether
there is anything to do.  That helper calls _start(), which calls
_pointer.unsafelyUnwrapped and traps in debug builds when the base
address is nil — which happens for InputSpan(), for empty ranges handed
to consumeSubrange closures, and for SubrangeConsumer drains once the
range is exhausted.

Add an early return for the zero-work case in each method, the same
pattern that removeAll() and deinit already use.  Release builds were
unaffected in practice because unsafelyUnwrapped skips the nil check
under -O, but the behaviour is formally undefined; this fix makes both
build modes consistent and safe.

Fixes #788

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Resolve conflict

Co-authored-by: Karoy Lorentey <klorentey@apple.com>

* Prefer guard for succinct exit conditionals

This follows our preferred coding style, and also syncs this code with OutputSpan's implementation in the stdlib.

Co-authored-by: Karoy Lorentey <klorentey@apple.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
1.7.4
2026-10-22 18:10:28 -07:00
Karoy Lorentey 885d9a7a7e Merge pull request #798 from aashish254/fix-bitarray-resizing-shift
[BitCollections] Fix BitArray.resizingShiftRight leaving stale bits
2026-10-22 18:09:51 -07:00
Karoy Lorentey 24b83c18c4 Merge pull request #799 from aashish254/fix-bitset-intersection-docs
[BitCollections] Fix BitSet intersection doc examples for Range inputs
2026-10-22 16:21:10 -07:00
Karoy Lorentey c266fe92b1 Fix typo; remove unnecessary usages of &-/&+ 2026-10-22 16:03:46 -07:00
Karoy Lorentey e6196f9c7a Merge pull request #797 from aashish254/cmake-add-rigidset-extras
[ContainersPreview] Add missing RigidSet+Extras.swift to CMake source list
2026-10-22 16:00:28 -07:00
Karoy Lorentey 701d2a9051 Fix tests to use withEvery for iteration
This gives us the necessary context data to diagnose test failures.
2026-10-22 11:09:30 -07:00
Joseph CursioandClaude Opus 5.5 a8a70a3495 [OrderedCollections] Check the remaining Hashable conformances (#792)
* Check OrderedSet.UnorderedView with checkHashable

The equivalence classes hold permutations of the same members, sets
that differ by one member or by count, and sets on both sides of the
hash table threshold, including small sets that carry a hash table or
reserved capacity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Check OrderedSet.SubSequence with checkHashable

The equivalence classes hold equal slices taken from different base
sets, at different offsets, and from bases with and without a hash
table, alongside slices that differ in order, members or count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Check OrderedDictionary.Values with checkHashable

The equivalence classes hold dictionaries with different keys but the
same value sequence, alongside values that differ in order, contents
or count, including repeated values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 11:03:17 -07:00
SwastikTripathi 0b51424337 Merge pull request #794 from SwastikTripathi/fix/borrowing-map-skip-infinite-loop
[BorrowingMapProducer] Fix skip(by:) hanging at end of iterator
2026-10-22 11:02:24 -07:00
Aashish fc31ca4a29 [BitCollections] Fix BitSet intersection doc examples for Range inputs
The examples for `intersection(_ other: Range<Int>)` and
`formIntersection(_ other: Range<Int>)` (on both `BitSet` and
`BitSet.Counted`) showed the result of the corresponding `subtract`
example instead: intersecting `[1, 2, 3, 4]` with `-10 ..< 3` yields
`[1, 2]`, not `[3, 4]`.
2026-10-22 16:34:53 +05:45
Aashish 297ffa296b [BitCollections] Fix BitArray.resizingShiftRight leaving stale bits
_resizingShiftRight(by:) copied the surviving suffix down to index 0 and
then removed `count &- amount` trailing bits instead of `amount`, so it
truncated the result to `amount` stale bits rather than keeping
`count - amount` valid ones. resizingShiftLeft(by: -n) was affected via
the same path, and the API had no test coverage at all.

Also fix the doc examples, which demonstrated the resizing shifts with
the masking shift function names (and, in one case, a result whose bit
count contradicted the documented growth by `amount`).

Add regression tests asserting parity with the documented semantics
(dropFirst / prepending false values) across word-boundary counts,
negative amounts, boundary `amount` values, and the doc examples
verbatim.
2026-10-22 15:27:56 +05:45
Aashish b84aa036f3 ContainersPreview: Add missing RigidSet+Extras.swift to CMake source list 2026-10-22 14:49:35 +05:45
Karoy Lorentey c141f557b0 Merge pull request #793 from lorentey/fix-botched-span-navigation
Fix nextSpan/previousSpan implementations
2026-10-21 20:19:19 -07:00