- 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
validateContainer checked the container's own count, underestimatedCount
and isEmpty for consistency, but never compared count against the number
of expected contents. Every loop that follows is bounded by the
container's count and indexes expectedContents at the same offset, so the
two failure modes were:
- A short expectation ran off the end. Where the expectation is a prefix
of the contents it matches its way to the end and then traps with
"Fatal error: Index out of range", killing the test process instead of
reporting a validation failure.
- A long expectation was accepted. Offsets past the container's count are
never looked at, so an expectation of twice the length passed.
The second is the worse of the two: a test can assert far less than it
appears to, and nothing says so.
One guard fixes both, placed after the container's own count consistency
checks so that a container with a broken count still reports that rather
than a size mismatch.
The regression test uses dropLast rather than dropFirst, and the comment
says why: dropFirst shifts every element, so a content mismatch at offset
0 is reported before the out-of-bounds access happens. That masks the
defect by coincidence rather than guarding against it, and a test written
that way would have passed against the unfixed code for the wrong reason.
Watched failing before the fix: the short case trapped with signal 5, the
long case reported "an expectation of 8 items must not validate against a
container of 4". Full suite with --traits UnstableContainersPreview: 893
tests, 0 failures, so none of the six existing checkContainer call sites
was relying on either behaviour.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Corrects 25 misspellings across DocC articles, design documentation and doc
comments. Prose only: no identifiers, no public API, no behaviour change.
| Typo | Correction | Count |
|---|---|---|
| `offseting` | `offsetting` | 7 |
| `valud` | `value` | 4 |
| `necessarilly` | `necessarily` | 3 |
| `recommmend` | `recommend` | 2 |
| `Mutablility` | `Mutability` | 1 |
| `childs` | `child's` | 1 |
| `constaints` | `constraints` | 1 |
| `destintion` | `destination` | 1 |
| `explan` | `explain` | 1 |
| `forcuses` | `focuses` | 1 |
| `ot` | `or` | 1 |
| `succcess` | `success` | 1 |
| `unqiue` | `unique` | 1 |
Two of these are worth a second look, since they are not pure spelling:
- `_HTable+Removal.swift:18` reads "without marking it as unoccupied ot
restoring the hash table's other invariants". Read as `or`, matching the
sentence, and deliberately not as a prefix of `other` later on the line.
- `_Node.UnsafeHandle+Deletion.swift:369` reads "reuse the left childs node".
Corrected to the possessive `child's` rather than `children`, which is what
a plain spellchecker suggests but does not fit the sentence.
`valud` is corrected to `value` to match the wording of the equivalent
parameter documentation on `swapAt(_:_:)`.
One change is outside documentation: `CheckContainer.swift:476` fixes
`succcess` inside a test assertion message. It is a human-readable string, not
an expected value, so no test behaviour changes.
Deliberately left alone:
- `isDisjoint(with:)-54iy6` in `OrderedSet.md` is a DocC disambiguation hash,
not a misspelling.
- `Peristent` in the 2022 ShareableHashedCollections review document, which is
an archived record of a past review rather than living documentation.
Found with `typos-cli`, then reviewed by hand; the tool's raw output also
flagged identifiers and symbol hashes, which are not included here.
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.
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.
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.
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`.
- 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
References to Span types trigger an issue where SwiftPM isn’t able to run command line executable targets or tests on older OSes.
Set the availability of everything that needs span types to the most recent Apple OS releases.
Hopefully we’ll be able to revert this once we figure out a better workaround.