Commit Graph
1885 Commits
Author SHA1 Message Date
Karoy Lorentey 2dae6db88f Merge pull request #697 from Hashim1999164/fix/sorted-dictionary-keys-values-equality
Fix inverted SortedDictionary Keys/Values/SubSequence equality
2026-08-11 14:25:33 -07:00
Karoy Lorentey 2875152465 Merge pull request #688 from inju2403/cleanup/replaceelement-reuse-replace
[OrderedCollections] Share OrderedSet's replace primitive with OrderedDictionary.replaceElement
2026-08-11 14:11:16 -07:00
Karoy Lorentey 04908ba292 Merge pull request #698 from Azoy/mutable-value-dictionary
[Rigid/UniqueDictionary] Add mutableValue(forKey:) to new dictionary types
2026-08-11 14:08:04 -07:00
Alejandro Alonso b2a1f89cc6 Add mutableValue(forKey:) to new dictionary types 2026-08-10 17:48:13 -07:00
Hashim1999164 01d981c87e Use tuple inequality in SortedDictionary.SubSequence equality.
Match the Keys and Values comparison style after review feedback.
2026-08-02 22:52:49 +05:00
Hashim1999164 1efcb6cabd Fix inverted equality in SortedDictionary Keys, Values, and SubSequence.
Equality comparisons returned false for matching elements and true for mismatches. Correct the comparisons and add coverage for the affected views.
2026-08-02 22:52:49 +05:00
Karoy Lorentey ff27e3678d Merge pull request #695 from lorentey/container-updates
More ContainersPreview updates
2026-07-29 13:04:07 -07:00
Karoy Lorentey 2e10584446 Add a default implementation for MutableContainer.swapAt (for copyable elements) 2026-07-28 19:43:07 -07:00
Karoy Lorentey ec66640a15 Add some (untested) PermutableContainer algorithms 2026-07-28 19:43:07 -07:00
Karoy Lorentey fbe36a7af5 Rearrange Sources/ContainersPreview/Protocols/* 2026-07-28 19:43:06 -07:00
Karoy Lorentey 01f13a1d0f Update docs 2026-07-28 19:43:06 -07:00
Karoy Lorentey 669eb09cea Use Iterable from the Standard Library, replacing the local definition 2026-07-27 13:32:46 -07:00
Karoy Lorentey 0afc8e0e16 Merge pull request #694 from lorentey/container-updates 2026-07-23 09:59:36 -07:00
Karoy Lorentey 1e5be56021 Merge pull request #691 from ZayanKhan-12/fix-internals-doc-links
Fix stale paths in internals documentation
2026-07-22 19:24:36 -07:00
Karoy Lorentey e12620f050 Update container design document 2026-07-22 19:07:54 -07:00
Karoy Lorentey 6b76536758 BidirectionalContainer: don’t re-declare distance(from:to:) as a non-overriding method
The original `Container` requirement is defined with the same semantics.
2026-07-22 19:07:41 -07:00
Karoy Lorentey 58e13a0525 Stop requiring BidirectionalContainer to provide comparable indices
This allows doubly linked lists to conform to the protocol.
2026-07-22 19:07:13 -07:00
Karoy Lorentey 3d45fae460 [BasicContainers] Add regression tests for RigidArray/UniqueArray’s expected memory layout 2026-07-22 19:04:48 -07:00
Karoy Lorentey 6cf1456327 Merge pull request #692 from Azoy/uniquearray-representation-change
[RigidArray/UniqueArray] Split up the buffer pointer in RIgidArray
2026-07-22 17:14:27 -07:00
Alejandro Alonso 73b55d00d0 Fix deinit on older compilers 2026-07-22 15:07:46 -07:00
Alejandro Alonso 4e6dc1b9dc Update CMakeLists.txt 2026-07-22 15:07:46 -07:00
Alejandro Alonso 389f79fd11 Fix unsafe pointer sources for older compiles 2026-07-22 15:07:45 -07:00
Alejandro Alonso 7f05a23266 Update CMakeLists.txt
Update CMakeLists.txt
2026-07-22 15:07:44 -07:00
Alejandro Alonso cbdda61d5d Split up the buffer pointer in RIgidArray 2026-07-22 15:07:41 -07:00
Karoy Lorentey 8380ca41da Merge pull request #682 from lorentey/container-updates
[ContainersPreview] Update Container protocols
2026-07-22 13:08:25 -07:00
ZayanKhan-12andClaude Fable 5 6321c6cc34 Fix stale paths in internals documentation
The test support library moved from Sources/_CollectionsTestSupport
to Tests/_CollectionsTestSupport; update the 23 links (and the one
label) in Documentation/Internals/README.md accordingly. The same
README's Benchmarks link and ReleaseChecklist's Utils script links
were written relative to the repo root rather than
Documentation/Internals/.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-22 14:46:57 -04:00
Karoy Lorentey 978e8a54a5 Additional fixes 2026-07-21 19:21:09 -07:00
Karoy Lorentey e7c2b34991 Fix typos and do some basic copy editing 2026-07-21 18:36:29 -07:00
Karoy Lorentey 376f4dc087 Document the container design [draft] 2026-07-21 16:32:03 -07:00
Karoy Lorentey 06f6b6bf49 Use borrow & mutate accessors in InputSpan’s unchecked subscript 2026-07-21 16:32:03 -07:00
Karoy Lorentey 232dc7f9ee Add second parameter to Container.makeBorrowingIterator(from:to:) 2026-07-21 15:21:45 -07:00
Seungju LeeandKaroy Lorentey 771d6984e4 [OrderedCollections] Use exchange(_:with:) to avoid copying the old value
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2026-07-21 19:37:07 +09:00
Karoy Lorentey 98bc1f9965 Fix some issues on earlier toolchains 2026-07-20 16:54:23 -07:00
Karoy Lorentey 82af14e8c0 Merge pull request #690 from apple/dependabot/github_actions/swiftlang/github-workflows/dot-github/workflows/swift_package_test.yml-0.0.13
Bump swiftlang/github-workflows/.github/workflows/swift_package_test.yml from 0.0.12 to 0.0.13
2026-07-20 16:06:03 -07:00
Karoy Lorentey f73340e588 Merge pull request #689 from apple/dependabot/github_actions/swiftlang/github-workflows/dot-github/workflows/soundness.yml-0.0.13
Bump swiftlang/github-workflows/.github/workflows/soundness.yml from 0.0.12 to 0.0.13
2026-07-20 16:05:47 -07:00
Karoy Lorentey ea64e6332f Update RandomAccessContainer
- Require Index to be Comparable
- Add `formIndex(_:offsetBy:limitedBy:)` algorithm
2026-07-20 15:45:32 -07:00
Karoy Lorentey e75f053e46 Update MutableContainer
- Add `nextMutableSpan(after:)` and `nextMutableSpan(after:maxCount:limitedBy)`, replacing `nextMutableSpan(after:maxCount:)` as the core access primitives
- Add `previousMutableSpan` default algorithms on bidirectional mutable containers
2026-07-20 15:44:35 -07:00
Karoy Lorentey ef0fba7f7f Resolve some implementation issues 2026-07-20 15:42:28 -07:00
Karoy Lorentey 95395ad9d2 Add BidirectionalContainer.spanBoundary(before:maxDistance:limitedBy:) and make it the core primitive 2026-07-20 11:51:43 -07:00
dependabot[bot] 22fd237a2c 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.12 to 0.0.13.
- [Release notes](https://github.com/swiftlang/github-workflows/releases)
- [Commits](https://github.com/swiftlang/github-workflows/compare/0.0.12...0.0.13)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-20 06:08:09 +00:00
dependabot[bot] b890aa8574 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.12 to 0.0.13.
- [Release notes](https://github.com/swiftlang/github-workflows/releases)
- [Commits](https://github.com/swiftlang/github-workflows/compare/0.0.12...0.0.13)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-20 06:08:08 +00:00
Karoy Lorentey e70b4df228 Introduce Container.nextSpan(after:maxCount:limitedBy:) and make it the core Container primitive 2026-07-18 14:14:13 -07:00
inju2403 f2d090be11 [OrderedCollections] Share OrderedSet's replace primitive with OrderedDictionary.replaceElement
#669 left `OrderedDictionary.replaceElement` untouched to keep that PR purely additive, noting it could later be reimplemented on top of `replace(at:with:)`. Both it and `OrderedSet.replace(at:with:)` performed the same "append the new member, swap it into position, then remove the old one from the end" step inline.

Factor that step into an internal `OrderedSet._replaceNew(at:with:in:)` primitive and call it from both, matching the existing `_appendNew` / `_removeExistingMember` primitives that `OrderedDictionary` already delegates its key-side mutations to. In `replaceElement` only the keys go through the primitive; the value at `index` is overwritten in place.

Sharing the mechanical step this way — rather than having `replaceElement` call `replace` directly — keeps each type's diagnostics intact: `OrderedDictionary` still traps with "Duplicate key: '\(key)'" and "Index out of range", not `OrderedSet`'s "Duplicate element" / "Index out of bounds". The shared step is already verified by the caller, so there is no behavior change.
2026-07-18 18:20:02 +09:00
Karoy Lorentey 391693a8ba Review and update BidirectionalContainer’s default implementations 2026-07-17 16:58:01 -07:00
Karoy Lorentey a7f6b90c99 Make the limit optional in Container.nextSpan(after:limitedBy:). Review and update default implementations
- Make `nextSpan(after:limitedBy:)` the core iteration interface
- Review default algorithms and update them to use it, speeding them up
- Spin off `Span._nextSpan(after:maxCount)` and `Span._nextSpan(after:limitedBy:)` with copying lifetime semantics. This allows forwarding to these without having to override lifetimes.
2026-07-17 16:57:26 -07:00
Karoy Lorentey 27fe58c42c Beef up ContainerIterator’s provided algorithms 2026-07-17 11:51:20 -07:00
Karoy Lorentey 99ac14d1fa previousSpan(before:maxCount:) ⟹ spanBoundary(before:maxDistance:)
This allows MutableContainers to support mutating iteration backwards without requiring a separate MutableBidirectionalContainer protocol.
2026-07-17 11:50:38 -07:00
Karoy Lorentey ea581e47e1 Add UnfoldProducer 2026-07-15 15:10:58 -07:00
Karoy Lorentey dcaffab0af Update Container
- Require Index to be Hashable
- Add strong complexity expectations. Require `isEmpty`, `count` and `endIndex` to have O(1) complexity. Recommend most index navigation methods to be linear in the distance traveled.
- Remove `index(alignedDown:)` and `index(alignedUp:)`; Collection views are far less relevant in this model, so index rounding is mostly unnecessary. (The need can still pop up when indices are shared between several views of layout-compatible Element types — such as a container of UInt64 than can also be interpreted as a container of UInt8; if that becomes a thing, we may need to bring these requirements back.)
- Add `nextSpan(after:limitedBy:)` as an alternative to `nextSpan(after:maximumCount:)`. This makes it possible to provide fast default implementations for `distance(from:to:)` and `formIndex(_:offsetBy:limitedBy:)`.
2026-07-15 15:10:58 -07:00
Karoy Lorentey 6210abf469 Update Producer/Drain algorithms
- Implement skip(by:) whenever possible
2026-07-14 17:54:03 -07:00