Commit Graph
1916 Commits
Author SHA1 Message Date
Karoy Lorentey 1f94ac8f54 Implement (partial) Container validation 2026-09-01 10:14:42 -07:00
Karoy Lorentey 225bd07e56 RigidSet, UniqueSet: Add Container conformance 2026-09-01 09:34:05 -07:00
Karoy Lorentey 57cf0d71d7 Merge pull request #707 from lorentey/container-updates
More container updates
2026-08-27 15:08:23 -07:00
Karoy Lorentey 842f125c47 Invert dependencies to ContainersPreview, moving all container APIs there
- Move `InputSpan` into its own module, `SpanPreview`. Add dependencies to it.
- Invert dependencies to `ContainersPreview`, so that no production target imports it, but it now depends on its previous dependents.
- Move all generic APIs and conformances using `Producer`/`Drain`/`Container` to the `ContainersPreview` module.
- Remove `UnstableContainersPreview` conditions around `Iterable` APIs

In summary, importing `BasicContainers` and `DequeModule` continue to get us the basic definitions for `RigidArray`, `UniqueSet`, `RigidDeque` etc., without most of their unstable APIs. (With the exception of core APIs that require `InputSpan`.)

To get any API that uses an unstable protocol like `Container` or `Drain`, we’ll now need to import `ContainersPreview` in addition to the type-defining module.

This will provide a slightly less horrible migration path when (if) the container/producer protocol family gets adopted/adapted into the stdlib.
2026-08-25 18:29:58 -07:00
Karoy Lorentey 633e46d3b4 [Xcode] Convert groups into folders
This will hopefully remove the need to update the project every time we add/remove/rename a source file.
2026-08-25 14:10:06 -07:00
Karoy Lorentey f607b99695 Update design docs 2026-08-25 14:10:06 -07:00
Karoy Lorentey 1574bed0dc [ContainersPreview] Spin off removal/consumption operations from RangeReplaceableContainer into a new DrainableContainer protocol
We have types that can usefully conform to `DrainableContainer` but not the full `RangeReplaceableContainer`; `OrderedSet` is one obvious example.
2026-08-25 14:10:06 -07:00
Karoy Lorentey 7e2a4bc761 Merge pull request #705 from karpovantonme/doc/sorted-collections
[SortedCollections] Name the documented arguments the way the declarations name them
2026-08-25 14:02:59 -07:00
Karoy Lorentey fcfa3b00cb Merge pull request #703 from inju2403/cleanup/replaceelement-exchange-same-key
[OrderedCollections] Use exchange(_:with:) in replaceElement's equal-key path
2026-08-25 14:02:39 -07:00
Karoy Lorentey 99b8eca1c2 Merge pull request #701 from karpovantonme/doc/parameter-names
Name the documented arguments the way the declarations name them
2026-08-25 13:50:46 -07:00
Karoy Lorentey cf53c6293f Merge pull request #706 from lorentey/workflow-fixes
[workflows] Update CI workflows
2026-08-25 13:13:32 -07:00
Karoy Lorentey d709ac585d [workflows] Package traits aren’t supported in Swift 6.0 and they aren’t declared in the 6.1 manifest 2026-08-20 17:26:14 -07:00
Karoy Lorentey 5d5c969bbf [workflows] Simplify version specifications
- Remove obsolete/unnecessary exclusions
- Remove obsolete macos_xcode_versions definition
- Prefer to define a small `linux_swift_versions` list to having a huge list of exclusions
2026-08-20 16:32:42 -07:00
Karoy Lorentey b28a99546b [workflows] Update to github-workflows@0.0.14 2026-08-20 16:30:25 -07:00
Karoy Lorentey ba06c4e0b6 [workflows] Update CI workflows
- Enable tests on FreeBSD
- Switch to symbolic Xcode version specifications that are based on the Swift version, not the precise Xcode version number. This lets us avoid having to laboriously update the specs every time Xcode gets a new minor release or beta — e.g., CI runners will pick up the latest Xcode they have installed that includes the specified Swift release.
- Stop excluding obsolete Swift versions that are no longer configured on runners.
- Add a job that tries to build the Xcode project at `Xcode/Collections.xcodeproj` under the latest Xcode on macOS.
- Add a job that runs tests with all unstable package traits enabled (`UnstableContainersPreview`, `UnstableHashedContainers`, `UnstableSortedCollections`.
- In exchange, change `hashed-container-tests` to only enable `UnstableHashedContainers`.
2026-08-18 18:16:37 -07:00
Karoy Lorentey f425dffd5b Merge pull request #702 from apple/dn/bit-set-count
Improve `BitSet.count` performance by ~3x
2026-08-18 13:54:33 -07:00
Karoy Lorentey 78798e7ae5 Merge pull request #704 from apple/dn/all-bits-inlineable
Mark `_Word.allBits` as `@inlinable`
2026-08-18 13:48:54 -07:00
Anton Karpov ed41e49a16 [SortedCollections] Name the documented arguments the way the declarations name them
Same species as #701, in the module behind the UnstableSortedCollections
trait. 16 doc comments name an argument the declaration does not have, and
one block documents a function that is no longer there.

The Keys and Values views carry the same four each: - Parameter i where the
argument is index, and - Parameter index on subscript(position:).

In the B-tree internals the descriptions usually name the right thing while
the key does not: - node on toNode(leftChild:) says the argument becomes the
left child, and - newElement on exchangeChild(atSlot:with newChild:) says it
is the new child.

_BTree.swift keeps a doc block for a function that was removed: it documents
an offset parameter and sits above an unrelated declaration.
2026-08-16 21:52:31 +03:00
David Nadoba 962d21d92d Mark _Word.allBits as @inlinable 2026-08-14 16:32:50 -07:00
inju2403 7a67033ee2 [OrderedCollections] Use exchange(_:with:) in replaceElement's equal-key path
#688 factored `replaceElement`'s general case onto `OrderedSet._replaceNew(at:with:in:)` and, per review feedback, switched the value overwrite there to `exchange(_:with:)`. The equal-key path above it was outside that diff, so it still reads the old value into a local and then assigns over it.

Switch it to `exchange(_:with:)` as well, so both paths move the old value out instead of copying it. No behavior change: the returned element, the preconditions, and the expected amortized O(1) complexity are all unchanged.
2026-08-14 09:19:43 +09:00
David Nadoba 8a050cd30d Improve BitSet.count performance 2026-08-13 13:52:01 -07:00
Anton Karpov c2b2092f94 Name the documented arguments the way the declarations name them
Twenty-five doc comments in the shipping modules name an argument that the
declaration below them does not have, so DocC has nothing to bind the
description to and drops it. Nothing warns about this.

Most of them are renames that the comment did not follow, and the file itself
usually holds the proof: RigidDeque.prepend says - maxCount while its own
Complexity line already says newItemCount, and append(copying:) has three
overloads where the oldest still takes newElements and the two newer ones take
items with the older one's wording.

Three entries name an argument that no longer exists at all and are removed
rather than renamed.
2026-08-13 16:29:06 +03:00
Alejandro Alonso f3e778f17a Merge pull request #699 from Azoy/eliminate-duplicate-bounds-checks
[Rigid/UniqueArray] Eliminate some duplicate bounds checks for UniqueArray
2026-08-12 15:24:17 -07:00
Alejandro Alonso d44d6a3a26 Update UniqueArray+Append.swift 2026-08-12 15:04:38 -07:00
Alejandro Alonso 830f90c0d5 Merge pull request #700 from Azoy/deque-malloc-size
[Deque/HashTree] Remove references to ManagedBuffer.capacity and use the given minCapacity
2026-08-12 15:02:31 -07:00
Alejandro Alonso d6c0fe063e Remove references to ManagedBuffer.capacity and use the given minCapacity
Fix errors

Update Deque._UnsafeHandle.swift
2026-08-12 14:09:05 -07:00
Alejandro Alonso 1b511f7652 Update UniqueArray+Append.swift 2026-08-12 14:07:15 -07:00
Alejandro Alonso 6c7ebb3cb9 Update UniqueArray+Append.swift 2026-08-12 13:32:38 -07:00
Alejandro Alonso dad98a58ca Replace inlinable with aEIC 2026-08-12 13:31:02 -07:00
Alejandro Alonso 4fd692f00b Apply review suggestions 2026-08-12 13:29:24 -07:00
Alejandro Alonso f2914d4fb4 Eliminate some duplicate bounds checks for UniqueArray 2026-08-12 12:25:12 -07:00
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