76 Commits
Author SHA1 Message Date
Karoy Lorentey 8f88cce7c7 [BasicContainers, ContainersPreview] Make sure package traits “work” on 6.2 toolchains
“Work” in this case means that they can be enabled without breaking the build — not necessarily that all features are available.

Swift 6.2 is highly prone to runtime crashes in `swift_getTypeByMangledName` in generic code that uses ownership features. Swift 6.3 will resolve that.
2026-03-17 15:38:34 -07:00
Karoy Lorentey 3dc65340f3 [ContainersPreview] Fix support for Swift 6.2 2026-03-17 13:45:15 -07:00
Karoy Lorentey 2364daa6bf [ContainersPreview] Update CMake & Xcode build files 2026-03-17 13:32:12 -07:00
Karoy Lorentey 29148932ec [ContainersPreview] Add a Producer.collect(into:) that takes a RangeReplaceableContainer
This is getting into dangerous territory, as RRC allows fixed-capacity conformers, where appending a producer must be done extremely carefully. We should be using bulk append operations, but never ask the container to reserve any more slots than the producer is able to actually generate. (When the fixed-capacity RRC was carefully sized to precisely fit the generator’s contents, asking it to provide space for even a single item more would lead to a runtime trap.)

Additionally, the algorithm should work (and be reasonably efficient) even if the RRC happens to be a dynamically sizing container type.

It would be nice if we had a Producer protocol flavor with an exact count; failing that, we can still do this with a bit of acrobatics, as implemented here.  (The `DynamicContainer.append(from:)` algorithm was already implemented this way in a previous commit, with an eye towards this case.)
2026-03-17 13:32:11 -07:00
Karoy Lorentey 2e277a949b [ContainersPreview] Add a BorrowingIteratorProtocol.copy() algorithm to turn borrowing iterators into producers 2026-03-17 13:32:11 -07:00
Karoy Lorentey d974987957 [ContainersPreview] DynamicContainer’s Producer-taking init/append methods should consume their input
(Because they are running it to completion.)
2026-03-17 13:16:43 -07:00
Karoy Lorentey 7e103afbb6 [ContainersPreview] Oops, fix constraints on conformances of BorrowingMapProducer and BorrowingFilter 2026-03-17 13:15:03 -07:00
Karoy Lorentey 6bbed0e1e2 [ContainersPreview] Conform [Unique,Rigid]Array and [Unique,Rigid]Deque to container protocols 2026-03-17 13:13:42 -07:00
Karoy Lorentey 121462fe19 [ContainersPreview] Add some implementations of .filter 2026-03-16 15:04:30 -07:00
Karoy Lorentey ea00086c7a [ContainersPreview] Update CMake/Xcode build configurations 2026-03-13 10:41:06 -07:00
Karoy Lorentey bf18a48983 [ContainersPreview] Spin off Producer.collect algorithms into a separate file for easy lookups 2026-03-13 10:41:04 -07:00
Karoy Lorentey c4760ec21a [ContainersPreview] Flesh out container protocols a little more; add algorithms
(This is all untested, unproven code)
2026-03-13 10:30:49 -07:00
Karoy Lorentey 6acfa78c6c [ContainersPreview] Quick updates to Container 2026-03-13 09:14:30 -07:00
Karoy Lorentey cde6e86f4f [ContainersPreview] Underscore elementsEqual for now, to avoid ambiguity with the Sequence method 2026-03-13 09:14:15 -07:00
Karoy Lorentey 41beccbd44 Merge pull request #598 from lorentey/remove-BorrowingSequence.first
[ContainersPreview] Remove BorrowingSequence.first
2026-03-09 16:40:18 -07:00
Karoy Lorentey 63030a3530 Merge pull request #599 from lorentey/generateNext-to-next
[ContainersPreview] Rename Producer.generateNext() to next()
2026-03-09 16:37:58 -07:00
Karoy Lorentey 3826fe76a8 [ContainersPreview] Rename Producer.generateNext() to next()
This better highlights the symmetry between it and the classic method on `IteratorProtocol`, and is also a nice usability win.
2026-03-09 16:22:24 -07:00
Karoy Lorentey 3b10b992bc [ContainersPreview] Remove BorrowingSequence.first
This property is unnecessary; it was just demonstrating an old problem. It clashes with the classic `Collection.first`, and that renders invocations of that ambiguous in code that uses Collection types that also have a BorrowingSequence conformance.
2026-03-09 16:11:56 -07:00
Karoy Lorentey 80878519f2 [doc] Fix most issues reported by docc
DocC keeps changing its link syntax. The latest iteration appears to have trouble dealing with `Self`-taking or `Self`-returning methods, so change our API to replace `Self` with a direct mention of the concrete type. ¯\\\_(ツ)\_/¯

That said, the new compiler also found a large number of mismatching parameter names, and that was really helpful.
2026-03-09 14:14:51 -07:00
Karoy Lorentey 1c69635852 Add SPDX-License-Identifier tags 2026-03-05 19:39:24 -08:00
Karoy Lorentey d9b09ecde8 Update copyright dates 2026-03-05 19:39:20 -08:00
Karoy Lorentey 214d75cb73 BorrowingSequence: estimatedCount ⟹ underestimatedCount
EstimatedCount is largely pointless. Knowing the exact count does enable a fast negative path for `elementsEqual`, but we can otherwise make do with just the (much simpler to understand/deal with) `underestimatedCount` that already exists on `Sequence`.
2026-03-05 15:33:27 -08:00
Karoy Lorentey b7545b990b [BasicContainers] Add bulk insertions to hashed set types 2026-02-27 13:36:37 -08:00
Karoy Lorentey 4452b1c960 [ContainersPreview] Mark ProducerError as a primary associated type of Producer 2026-02-24 16:41:31 -08:00
Karoy Lorentey a14f9eb61c [BasicContainers] Add missing imports of ContainersPreview 2026-02-23 13:56:38 -08:00
Karoy Lorentey 3941dab5b0 [BasicContainers] Implement removals on RigidSet and UniqueSet
Dictionaries are still to be done.
2026-02-20 18:19:51 -08:00
Karoy Lorentey bf9a7033a0 [BasicContainers] Add early drafts for RigidSet/RigidDictionary 2026-02-16 17:15:59 -08:00
Karoy Lorentey 934ad786d2 Merge pull request #570 from lorentey/remove-outputspan-workaround
Remove workaround for bug in OutputSpan.wUMBP
2026-02-16 17:14:44 -08:00
Karoy Lorentey 5a4ee8be66 Update docs for Container.nextSpan(after:maximumCount:)
Oops, the docs did not explain `maximumCount`.
2026-02-16 15:49:33 -08:00
Karoy Lorentey 8ef702c8a5 Remove workaround for OutputSpan.wUMBP bug 2026-02-05 17:07:03 -08:00
Karoy Lorentey 6c1d4ab9c8 Update Xcode and CMake build configurations 2026-02-04 23:24:11 -08:00
Karoy Lorentey e4a874b67a Rigid & Unique types: Add Equatable, Hashable, Custom[Debug]StringConvertible operations
Currently these are all conditional on copyable elements, and the types cannot conform to the actual protocols yet.
2026-02-04 23:24:08 -08:00
Karoy Lorentey 7692d9c4b3 RigidArray: Add test coverage; revive some container-based operations 2026-02-04 22:41:33 -08:00
Karoy Lorentey 0b8e5971d8 Another spot where we call the stdlib’s OutputSpan.wUMBP 2026-02-04 17:47:50 -08:00
Karoy Lorentey 9503f8fe57 Improve consistency of precondition failure messages
More uniform message strings should feel better, and they should ever so slightly reduce code size.
2026-02-04 10:27:17 -08:00
Karoy Lorentey 030f751515 [BasicContainers] RigidArray, UniqueArray: Fill out missing indexing APIs 2026-02-03 14:06:03 -08:00
Karoy Lorentey 772c426bc9 Oh this is proving a bit more difficult than ideal 2026-01-29 15:02:53 -08:00
Karoy Lorentey 801d361bbb Reinstate OutputSpan additions accidentally removed during merge 2026-01-29 14:39:07 -08:00
Karoy Lorentey 70dd9cd5d9 Merge branch 'main' into all-hands-on-deque
# Conflicts:
#	Sources/BasicContainers/RigidArray+Insertions.swift
#	Sources/ContainersPreview/OutputSpan+Extras.swift
2026-01-29 14:29:47 -08:00
Karoy Lorentey d1efcb19db More wrinkles! Shar Peis are adorable 2026-01-29 13:23:07 -08:00
Karoy Lorentey ffc56156a5 Wrinkles on top of wrinkles… 2026-01-29 13:16:39 -08:00
Karoy Lorentey 31e9e7c2f0 Oops, don’t use the workaround in 6.2
The 6.2 implementation works okay, but it loses the base address in the exposed buffer happens to be empty.
2026-01-29 13:04:57 -08:00
Karoy Lorentey 1bced00e1c Sigh, disable withTemporaryOutputSpan on 6.2
The RigidDeque effort will land a polyfill for temporary allocations to let us use this on 6.2.
2026-01-29 12:08:01 -08:00
Karoy Lorentey e8d53861ae Move OutputSpan.wUMBP workaround to ContainersPreview, and use it there, too 2026-01-29 11:36:52 -08:00
Karoy Lorentey 4c9a0da7f1 Update CMake configuration 2026-01-26 12:31:36 -08:00
Karoy Lorentey 3a1498781a Fix support for older compilers 2026-01-26 11:18:59 -08:00
Karoy Lorentey 9a4ee93406 Simplify some RIgidArray operations 2026-01-26 11:18:59 -08:00
Karoy Lorentey 76fa120c27 More RigidDeque testing 2026-01-26 11:18:57 -08:00
Karoy Lorentey 29b31e5e0d RigidDeque: Add test coverage; fix issues 2026-01-25 16:42:41 -08:00
Karoy Lorentey 70a36c2c47 RigidDeque: Another iterative design pass on deque operations
- Adopt and embrace Drain and Producer to simplify moving data in and out of deques.
- Fully generalized core range replacement primitive using higher-order functions based around InputSpan and OutputSpan
2026-01-25 16:42:40 -08:00