60 Commits
Author SHA1 Message Date
Karoy Lorentey a807eb67ee Merge pull request #851 from Joseph-Cursio/producer-throwing-closure-tests
Test Producer.reduce and map with a throwing closure
2026-11-19 14:16:09 -08:00
Karoy Lorentey 8f033f1450 MutableContainer.updateElements: Keep consistent with MutableSpan proposal 2026-11-16 11:35:33 -08:00
Joseph CursioandClaude Opus 5.5 0b3faf58d9 Test Producer.map with a throwing transform
Check that next() and reduce(into:_:) over the mapped producer rethrow
the transform's error, stop calling it after it throws, pass on only
items mapped before the failure, in order, and leak nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 07:52:21 -06:00
Joseph CursioandClaude Opus 5.5 598f867179 Test Producer.reduce with a throwing closure over noncopyable items
Check that reduce(_:_:) and reduce(into:_:) rethrow the closure's error,
stop calling it after it throws, and leak nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 07:50:42 -06:00
Aashish fc11462e69 Fix ContainerIterator skip bounds 2026-11-09 21:42:36 +05:45
Sandeep Vijayarao 2c246541db Fix six small bugs in _CollectionsTestSupport
- withEveryDeque/withEveryFullDeque now visit capacity 0.
- checkEquatable reports transitivity violations instead of trapping
  when pairs arrive out of order (non-transitive oracles, maxSamples).
- Minimal range-replaceable collections no longer trap in removeLast()
  and popLast().
- LifetimeTracked's "Double deinit" precondition can now fire.
- withEvery, withEveryRange and withSomeArrayLayouts include the
  failing value in their "Throwing trace".
- CustomCountedProducer drops its unused chunkSize parameter, and the
  two loops that reran identical cases over it are removed.

Adds regression tests for the first three.

Fixes #810
2026-11-05 13:52:56 -08:00
Karoy Lorentey 7b578e5bfb Review and fix filter implementations
- Define a separate `filter` result on Iterable vs BorrowingIteratorProtocol
- Fix handling of delimited iterators in Container.filter
- Add fixmes for throwing
- Inlinability and other small fixes
2026-11-04 18:28:38 -08:00
Karoy Lorentey b14ab924a5 Fix PermutableContainer algorithms 2026-11-03 16:04:44 -08: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
Karoy Lorentey e13f175180 Review RigidDeque/UniqueDeque tests; add better tests for prepends 2026-10-26 18:01:57 -07:00
Karoy Lorentey 6f813c3497 Update tests 2026-10-21 17:30:09 -07:00
Karoy Lorentey 9e7949017a Tests: add unsafe keywords where needed 2026-10-01 11:44:47 -07:00
Karoy Lorentey 44b674265c Update import statements 2026-09-29 15:41:05 -07:00
Karoy Lorentey 1a1818df8f Drop unused Optional._borrow, ._mutate and _insert definitions 2026-09-23 15:45:26 -07:00
Karoy Lorentey 3cd6ca91d5 Drop bad Iterable tests 2026-09-22 19:19:20 -07:00
Karoy Lorentey 9bf8a9763b Merge pull request #729 from lorentey/release-prep
1.7.0 release preparations
2026-09-22 12:42:05 -07:00
Karoy Lorentey 8104faa3af Fix errors uncovered by new workflow configuration 2026-09-21 14:10:43 -07:00
Karoy Lorentey 537bf9cbfb Drop support for Swift 6.0 and 6.1
This allows the use of Span types without `#if compiler` guards.
2026-09-21 13:34:39 -07:00
Karoy Lorentey 8e4f078441 Producer.generate(into:): Switch to saturating semantics
This noticeable simplifies client code, as clients invariably want to fully populate their buffer (when possible). It also is consistent with the semantics of `Iterable.skip(by:)`.
2026-09-21 13:07:01 -07:00
Karoy Lorentey d392f0cbff MutableContainer: Add tests; resolve issues uncovered 2026-09-21 09:54:29 -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 669eb09cea Use Iterable from the Standard Library, replacing the local definition 2026-07-27 13:32:46 -07:00
Karoy Lorentey c6eabe862a Resolve access issues & missing imports 2026-07-07 14:34:41 -07:00
Karoy Lorentey ff695132ed Bump availability of Iterable_ and Container protocols to SwiftStdlib 6.4
This is preparing for switching over to the stdlib’s definition of `protocol Iterable`, assuming it will land with macOS 27/iOS 27 etc availability; `Container` is refining `Iterable`, so it needs matching availability.

If `Iterable` won’t ship in Swift 6.4, then we’ll need to bump this again.
2026-07-07 14:22:45 -07:00
Karoy Lorentey d0b4c4c215 IterableIterator_ → BorrowingIterator_ 2026-07-07 14:21:53 -07:00
Karoy Lorentey bb0dc189ef maximumCount → maxCount
While we’re here, adjust `RigidSet.insert(maximumCount:initializingWith:)` and similar APIs to be consistent with RangeReplaceableContainer’s methods.
2026-07-07 14:21:53 -07:00
Karoy Lorentey 1f5d0ab343 [BasicContainers, DequeModule] Resolve warnings in 6.4 2026-06-18 13:21:42 -07:00
Karoy Lorentey 3d68fc1107 Clean up the UniqueBox/Ref/MutableRef situation
- UniqueBox is public API, so we cannot remove it in favor of the stdlib’s
- Remove Ref and MutableRef. Keep an internal _MutableRef to work around stdlib limitations.
2026-06-17 18:29:41 -07:00
Karoy Lorentey 85cdb77d25 Fix build issues 2026-06-17 16:17:36 -07:00
Nate Cook c039a18a0e Switch to using stdlib Ref and UniqueBox 2026-06-17 14:27:29 -07:00
Nate Cook dca015d7e8 Align Iterable with proposal
Adds throwing and ~Escapable elements
2026-06-17 14:27:29 -07:00
Nate Cook 4bda43f4a9 Renaming BorrowingSequence_ to Iterable_ 2026-06-17 14:27:29 -07:00
Karoy Lorentey 40c730869d [ContainersPreview] Add more detailed tests for MutableRef’s API surface 2026-05-06 18:34:57 -07:00
Karoy Lorentey 16d6b8e1fe [ContainersPreview] Inout ⟹ MutableRef 2026-05-06 18:28:07 -07:00
Karoy Lorentey 05f19cf771 [ContainersPreview] Add more detailed tests for struct Ref 2026-05-06 18:00:13 -07:00
Karoy Lorentey a6fd64697a [ContainersPreview] Borrow ⟹ Ref
Also update the type’s public API surface to reflect SE-0519, leaving deprecated aliases for the old names.
2026-05-06 18:00:13 -07:00
Franz Busch 3c373b900c Use the defines from traits directly
Package traits already pass defines with their trait name when building. Instead of adding our own conditional defines based on the traits we can use the trait provided defines directly. I observed that various tooling behaves better with the trait provided defines.
2026-05-06 07:41:02 -07:00
Karoy Lorentey 3177a4c29a [ContainersPreview] Add more detailed tests for UniqueBox 2026-05-05 17:31:09 -07:00
Karoy Lorentey 146056a641 [ContainersPreview] Box ⟹ UniqueBox
Also update the type’s public API surface to reflect SE-0517, leaving deprecated aliases for the old names.
2026-05-05 17:31:05 -07:00
Karoy Lorentey 868c664c21 [test, ContainersPreview] Stop spuriously failing tests on older compilers 2026-04-21 14:49:20 -07:00
Karoy Lorentey 597b7a7dd2 Revert most of the availability constraints from 419e2f and 4c0482 🎉 2026-03-27 11:25:43 -07:00
Nate Cook f82d23faf5 Remove incompatible InlineArray syntax 2026-03-27 09:36:05 -05:00
Nate Cook e7ad6ff3cb Clean up availability / test / platform 2026-03-27 08:42:00 -05:00
Nate Cook f6f112e716 Update BorrowingSequence test 2026-03-27 08:31:35 -05:00
Nate Cook a99a015934 Disambiguate ContainersPreview and stdlib
Adds trailing underscores to the BorrowingSequence protocols and
requirements, in order to allow both parallel conformances and
the ability to evolve the requirements in this package.
2026-03-27 07:41:32 -05:00
Karoy Lorentey 4c04822689 [ContainersPreview] Exhibit B in the case against prototyping things in the stdlib 😳 2026-03-26 18:13:22 -07:00
Karoy Lorentey 1a8db43736 [ContainersPreview] Link BorrowingSequenceTests to xcodeproj; fix its imports 2026-03-26 16:06:49 -07:00
Nate Cook 71eb226b05 Gate InlineArray uses behind 6.2 compiler check 2026-03-26 14:25:01 -05:00
Nate Cook 2eac7ce64d Add tests for BorrowingSequence
With just enough algorithms (reduce, elementsEqual) to test.
2026-03-26 14:25:01 -05:00
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