Commit Graph
2078 Commits
Author SHA1 Message Date
Karoy Lorentey bbdd37ada7 Fix a variety of issues in the nextSpan/previousSpan method family 2026-10-21 19:56:55 -07:00
Karoy Lorentey 1522a8a85d RigidArray, UniqueArray: Deprecate ancient span methods 2026-10-21 19:39:43 -07:00
Karoy Lorentey da4ca36d4a Merge pull request #789 from lorentey/saturate-producer-buffers
Saturate producer buffers
2026-10-21 18:42:14 -07:00
Karoy Lorentey 6f813c3497 Update tests 2026-10-21 17:30:09 -07:00
Karoy Lorentey 1e51781091 UniqueSet.init(minimumCapacity:from:): Make sure we allocate storage for at least minimumCapacity items 2026-10-21 17:29:42 -07:00
Karoy Lorentey abddfb7ced Producer.map: Saturate generate(into:) target 2026-10-21 17:29:03 -07:00
Karoy Lorentey fcca0e3e2b Producer.filter: Saturate generate(into:) target, and fix underestimatedCount 2026-10-21 17:28:42 -07:00
Karoy Lorentey c314bdad78 Producer.skip(by:): Don’t skip fewer than n items unless we reach the end 2026-10-21 17:27:51 -07:00
Karoy Lorentey a67da2273b Merge pull request #784 from sebxt/fix/bigstring-removesubrange-stale-breaks
[BigString] Resync character breaks after removeSubrange
2026-10-21 16:34:13 -07:00
Karoy Lorentey 83e5f26fba Merge pull request #782 from aashish254/fix-774-rigidset-insert-hang
[BasicContainers] Fix RigidSet/UniqueSet batch insertion never terminating without the preview trait
2026-10-21 16:33:58 -07:00
Karoy Lorentey 4d092451ef Merge pull request #781 from aashish254/fix-772-replace-subrange-returned-range
[BasicContainers] Fix returned range of replaceSubrange(_:addingCount:initializingWith:)
2026-10-21 16:33:43 -07:00
Karoy Lorentey 6572a1b7f4 Merge pull request #777 from SwastikTripathi/fix/unique-deque-prepend-producer-order
[UniqueDeque] Fix prepend(from:) reversing batch order across producer passes
2026-10-21 16:33:30 -07:00
Karoy Lorentey 1209f9e410 Merge pull request #776 from aniketatgithub/fix-771-uniquearray-append-moving
[BasicContainers] Fix UniqueArray.append(moving:) dropping and leaking every element
2026-10-21 16:33:17 -07:00
Karoy Lorentey d71f913943 Merge pull request #769 from Joseph-Cursio/identity-checker
Add checkSetAlgebraMemberIdentity, a law checker for which equal member SetAlgebra keeps
2026-10-21 16:33:01 -07:00
Karoy Lorentey 156d116ec6 Merge pull request #768 from Joseph-Cursio/rigidset-hash-terminates
[BasicContainers] Fix RigidSet.hash(into:) never returning
2026-10-21 16:32:40 -07:00
Karoy Lorentey d0ed72e8a5 Merge pull request #779 from apple/dependabot/github_actions/swiftlang/github-workflows/dot-github/workflows/soundness.yml-0.0.16
Bump swiftlang/github-workflows/.github/workflows/soundness.yml from 0.0.15 to 0.0.16
2026-10-21 16:06:39 -07:00
Karoy Lorentey 45f56de8f9 Merge pull request #780 from apple/dependabot/github_actions/swiftlang/github-workflows-0.0.16
Bump swiftlang/github-workflows from 0.0.15 to 0.0.16
2026-10-21 16:06:08 -07:00
Karoy Lorentey 2adb7e6f9c Merge pull request #778 from apple/dependabot/github_actions/swiftlang/github-workflows/dot-github/workflows/swift_package_test.yml-0.0.16
Bump swiftlang/github-workflows/.github/workflows/swift_package_test.yml from 0.0.15 to 0.0.16
2026-10-21 16:05:51 -07:00
Karoy Lorentey bf9b4623a1 UniqueDeque.prepend: Add perf FIXME 2026-10-21 16:04:49 -07:00
Karoy Lorentey 357a4bc876 Merge pull request #775 from glessard/outputspan-inputspan
Fix implementation of OutputSpan._consumeAll()
2026-10-21 15:56:33 -07:00
Karoy Lorentey d6d73d786c Merge pull request #767 from Joseph-Cursio/bitset-counted-check-bidirectional
[BitCollections] Check BitSet.Counted's BidirectionalCollection conformance
2026-10-21 15:42:41 -07:00
Sebastian Turner 6f8f55a5ad [BigString] Resync character breaks after removeSubrange
Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>
2026-10-20 16:18:03 -07:00
Aashish bd5960886c [BasicContainers] Fix RigidSet batch-insertion loop never terminating
insert(addingCount:initializingWith:) batches elements through a
temporary OutputSpan and loops while `remainder > 0`. When the
`UnstableContainersPreview` trait is disabled, the span's `defer`
handler moved elements out of the temporary buffer but never decremented
`remainder`, so the loop spun forever whenever the initializer didn't
fill every batch. Update `remainder` the same way the preview branch
already does, and add a regression test (issue #774).
2026-10-20 21:18:09 +05:45
Aashish 96648ca1d8 Fix replaceSubrange(_:addingCount:initializingWith:) returning a range sized by the requested count
The closure-based replaceSubrange overloads on RigidArray (and, through
them, UniqueArray and the generic RangeReplaceableContainer overloads)
returned subrange.lowerBound ..< subrange.lowerBound + newItemCount even
when the initializer performed a short fill, so the returned range could
cover old elements that were never replaced and extend past endIndex.
Return the number of items actually initialized (span.count), matching
insert(addingCount:at:initializingWith:).

Fixes #772
2026-10-20 19:45:05 +05:45
dependabot[bot] bee13af470 Bump swiftlang/github-workflows from 0.0.15 to 0.0.16
Bumps [swiftlang/github-workflows](https://github.com/swiftlang/github-workflows) from 0.0.15 to 0.0.16.
- [Release notes](https://github.com/swiftlang/github-workflows/releases)
- [Commits](https://github.com/swiftlang/github-workflows/compare/0.0.15...0.0.16)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-19 06:06:33 +00:00
dependabot[bot] 7794eb579b 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.15 to 0.0.16.
- [Release notes](https://github.com/swiftlang/github-workflows/releases)
- [Commits](https://github.com/swiftlang/github-workflows/compare/0.0.15...0.0.16)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-19 06:06:29 +00:00
dependabot[bot] 67b918a0e2 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.15 to 0.0.16.
- [Release notes](https://github.com/swiftlang/github-workflows/releases)
- [Commits](https://github.com/swiftlang/github-workflows/compare/0.0.15...0.0.16)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-19 06:06:24 +00:00
Swastik TripathiandClaude Opus 5.5 5d4a707373 [UniqueDeque] Fix prepend(from:) reversing batch order when producer needs multiple passes
prepend(from:) looped calling uncheckedPrepend, which each time placed the
new batch at index 0 of the deque. Later batches ended up in front of earlier
ones, producing items in the wrong order.

Fix: use uncheckedInsert(addingCount:at:added) so each new batch is inserted
immediately after the items already prepended in earlier passes. Promote the
overload from internal to package so ContainersPreview can reach it.

Adds a regression test covering single- and multi-batch producers prepending
into empty and non-empty deques. Fixes #763.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-19 08:35:03 +05:30
Aniket 80d8052b4b [BasicContainers] Fix UniqueArray.append(moving:) dropping and leaking every element
Signed-off-by: Aniket <aniketkomailkro@gmail.com>
2026-10-17 02:21:15 -07:00
Guillaume Lessard ff3c6e58ce Empty OutputSpan before closure can throw in _consumeAll() 2026-10-16 17:58:04 -07:00
Guillaume Lessard f48752c73a Test OutputSpan’s _consumeAll() method 2026-10-16 17:53:20 -07:00
Joseph CursioandClaude Opus 5.5 e700932e3b Check SortedSet with checkSetAlgebraMemberIdentity
Run the member identity checker against SortedSet, including a
multi-level tree. With #761's fix reverted, it fails with the wrong
member stored by insert(_:) and update(with:), as reported in #760.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 14:49:07 -05:00
Joseph CursioandClaude Opus 5.5 5e46772f5e Check OrderedSet.UnorderedView with checkSetAlgebraMemberIdentity
Run the member identity checker against OrderedSet's unordered view,
covering both the unhashed and hashed storage paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 14:44:55 -05:00
Joseph CursioandClaude Opus 5.5 358f0a7034 Check TreeSet with checkSetAlgebraMemberIdentity
Run the member identity checker against TreeSet over empty, small and
multi-level models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 14:44:55 -05:00
Joseph CursioandClaude Opus 5.5 6f570e0ad8 Add checkSetAlgebraMemberIdentity
Check which of two equal but distinguishable members insert(_:),
update(with:) and remove(_:) keep and return, using Set as the
reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 14:44:55 -05:00
Karoy Lorentey b905c889ff Merge pull request #759 from Joseph-Cursio/check-set-algebra-sequences
Check the set predicates and isEqualSet(to:) against plain sequences
2026-10-15 12:39:57 -07:00
Karoy Lorentey 072a7a1643 Merge pull request #758 from Joseph-Cursio/sortedset-check-set-algebra
[SortedCollections] Check SortedSet's SetAlgebra conformance
2026-10-15 12:39:33 -07:00
Karoy Lorentey f0c713391c Merge pull request #761 from aniketatgithub/fix-sortedset-insert-update-760
SortedSet: keep the existing member on insert, replace it on update(with:)
2026-10-15 12:38:55 -07:00
Joseph CursioandClaude Opus 5.5 c65469e45f Fix RigidSet.hash(into:) never returning
_rawHashValue(seed:) looped on nextSpan() without checking for the
empty span the iterator returns once it is exhausted, so hashing any
RigidSet or UniqueSet spun forever. Break on an empty span, as == does.

Add test_hashable for both types, modeled on RigidArrayTests: equal
sets built with different capacities and insertion orders must hash
equally. Both tests hang without the fix.

Fixes #765.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 07:29:43 -05:00
Joseph CursioandClaude Opus 5.5 a727e193c7 Check BitSet.Counted's BidirectionalCollection conformance
BitSet.Counted keeps its own count and forwards its index operations to
BitSet, but no test ran it through a collection checker. Run
checkBidirectionalCollection on it with the same inputs as BitSet's
test_collection_strides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 05:59:44 -05:00
Karoy Lorentey 50583b7adf Merge pull request #766 from glessard/inputspan-removeall
Fix implementation of `InputSpan.removeAll()`
2026-10-14 18:03:39 -07:00
Guillaume Lessard 4ff4e75436 Fix implementation of removeAll() 2026-10-14 17:28:49 -07:00
Guillaume Lessard 9ebb1ae5a3 Test InputSpan’s removeAll() method 2026-10-14 17:28:48 -07:00
Aniket 7353b0ca86 SortedSet: keep the existing member on insert, replace it on update(with:)
Signed-off-by: Aniket <aniketkomailkro@gmail.com>
2026-10-14 08:21:27 +00:00
Joseph CursioandClaude Opus 5.5 2f2c59a39b checkSetAlgebra: Repeat the sequence enough to expose counted duplicates
Doubling the other model's elements only exposes an implementation that
counts occurrences instead of distinct members when the two sets share
at least half of the receiver's elements, which depended on the models
a test happened to pick. A BitSet.isStrictSubset that counted
duplicates passed every model pair. Repeat the other model
`xm.count + 2` times instead, so a shared element always appears more
often than the receiver has members.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 20:59:19 -05:00
Joseph CursioandClaude Opus 5.5 edaba634e4 checkSetAlgebra: Also pass a sequence that underestimates its count
Every sequence the checker passed reported its exact count, so an
implementation that trusts underestimatedCount went unnoticed: an empty
TreeSet whose isEqualSet returned `other.underestimatedCount == 0`
passed every test. Also check the predicates and isEqualSet against a
single-pass MinimalSequence, whose underestimatedCount is 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 20:17:24 -05:00
Joseph CursioandClaude Opus 5.5 13c9b46f1d Check BitSet.Counted's SetAlgebra conformance
BitSet.Counted's tests declare SetAPIExtras, but it was never run
through checkSetAlgebra. Use the same models as BitSet's test. With the
isEqualSet check from the previous commit, this fails if #749's fix is
reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 20:10:12 -05:00
Joseph CursioandClaude Opus 5.5 9d4284eb0e checkSetAlgebra: Check isEqualSet(to:) for SetAPIExtras types
No checker exercised isEqualSet(to:), and no test passed it a sequence
with duplicates, so #749's bug, where BitSet.Counted rejected such
sequences, went unnoticed until it was reported. Add a checkSetAlgebra
overload for SetAPIExtras types that also checks isEqualSet against the
models: given another Self, an Array, an Array with duplicates, and a
Set, which takes the _UniqueCollection path in the types that have one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 20:10:12 -05:00
Joseph CursioandClaude Opus 5.5 d54c0be657 checkSetAlgebra: Check the predicates against plain sequences too
The five predicates were only ever given another Self, so a type whose
Sequence-taking overloads first check for Self never ran their
general path under the checker. Check them against an Array of the
other model, with and without duplicates, as the set operations
already are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 20:10:12 -05:00
Joseph CursioandClaude Opus 5.5 722b029996 Check SortedSet's SetAlgebra conformance
SortedSet declares SetAPIChecker since #746, but was never run through
checkSetAlgebra. The models are the same as TreeSet's and OrderedSet's,
plus three larger ones so that the sets span more than one B-tree level
in debug builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 19:00:13 -05:00