Commit Graph
1647 Commits
Author SHA1 Message Date
Karoy Lorentey 6017342a4d Merge pull request #616 from inju2403/feature/ordered-dictionary-replace-element-at-index
[OrderedCollections] Add OrderedDictionary.replaceElement(at:withKey:…
2026-04-27 18:05:52 -07:00
Karoy Lorentey b8e1bc9444 Merge pull request #625 from apple/dependabot/github_actions/swiftlang/github-workflows/dot-github/workflows/soundness.yml-0.0.11
Bump swiftlang/github-workflows/.github/workflows/soundness.yml from 0.0.10 to 0.0.11
2026-04-27 18:05:17 -07:00
Karoy Lorentey ff4a5a3cc4 Merge pull request #631 from FranzBusch/fb-fix-drain
Fix _trim(first:) returning wrong buffer region
2026-04-27 17:11:41 -07:00
Franz Busch 793bcd5d66 Update the count 2026-04-25 17:43:25 +02:00
Franz Busch c12dabe1b8 Fix _trim(first:) returning wrong buffer region
After reassigning self on line 160, baseAddress on line 161 resolves to the new self's baseAddress (oldStart + cut) instead of the original start. This causes the returned buffer to point past the actual elements into uninitialized memory. Use the captured oldStart instead.
2026-04-25 00:09:23 +02:00
inju2403 8c5830ee46 [OrderedCollections] OrderedDictionary.replaceElement: allow the new key to equal the key at index
Per review feedback, relax the precondition so that the new key may compare equal to the key currently stored at index. This enables replacing an existing key with an equal-but-not-identical instance — for example, swapping a decomposed Unicode string with its precomposed equivalent — without an inefficient remove/insert workaround.

When the new key matches the one being replaced, the pair is updated in place via OrderedSet.update(_:at:) and the hash table is left untouched, preserving the expected amortized O(1) complexity.

Add a test_replaceElement_sameKey test on both OrderedDictionary and its Elements view that exercises the new path with LifetimeTracked keys carrying equal payloads but distinct instances.
2026-04-23 21:38:11 +09:00
Karoy Lorentey c8080d050d Merge pull request #630 from lorentey/fix-uniquearray-copying-replace-overallocation
[BasicContainers] UniqueArray.replace(removing:copying): Fix overallocation issue
2026-04-22 16:40:02 -07:00
Karoy Lorentey 5bd8ab095d [BasicContainers] UniqueArray.replace(removing:copying): Fix overallocation issue
`UniqueArray.replace(removing:copying:)` overloads overestimated the amount of memory they need, sometimes leading to unnecessary reallocations. Fix this.
2026-04-22 16:23:15 -07:00
Karoy Lorentey 6ed215dcc2 Merge pull request #629 from lorentey/fix-fancy-rigidarray-replacement
[BasicContainers] RigidArray.replace(removing:consumingWith:addingCount:initializingWith:): Fix correctness issue with partial initialization
2026-04-22 16:10:13 -07:00
Karoy Lorentey b0a7a4df1d Merge pull request #628 from lorentey/fix-rigidset-insert
[BasicContainers] RigidSet.insert(maximumCount:from:): Fix spurious capacity overflow caused by incorrect accounting
2026-04-22 15:48:02 -07:00
Karoy Lorentey d8ace00d14 [BasicContainers] RigidArray.replace(removing:consumingWith:addingCount:initializingWith:): Fix correctness issue with partial initialization
The original code was invoking `_closeGap` with an incorrect size (from `append` rather than `replace`), leading to runtime traps and potential memory safety issues if the `resize` invocation ends up underfilling the container.
2026-04-22 15:32:55 -07:00
Karoy Lorentey b75bd4ef01 [BasicContainers] RigidSet.insert(maximumCount:from:): Fix spurious capacity overflow caused by incorrect accounting 2026-04-22 15:12:55 -07:00
Karoy Lorentey f25e1b38fe Merge pull request #627 from lorentey/add-bitset-iterator-shortcut
[BitSet] Add `BitSet.makeIterator(from:)`
2026-04-22 15:11:15 -07:00
Karoy Lorentey 084be39d7e [BitSet] Add makeIterator(from:)
This enables faster iteration over subranges of a BitSet than the `Slice` type’s default indexing iterator. (Depending on the fill factor, the speedup can be as high as 4x — not insignificant.)
2026-04-21 16:28:14 -07:00
Karoy Lorentey 32e7c0e1ec [Benchmark] Add BitSet iteration vs index(after:) benchmarks 2026-04-21 16:28:11 -07:00
Karoy Lorentey bfa0a8b306 Merge pull request #626 from lorentey/adjust-experimental-workflows
Adjust experimental workflows
2026-04-21 16:09:51 -07:00
Karoy Lorentey b03e9b68fd [github] Don’t run containers/hashed containers tests on Swift 6.3 2026-04-21 14:49:53 -07:00
Karoy Lorentey 868c664c21 [test, ContainersPreview] Stop spuriously failing tests on older compilers 2026-04-21 14:49:20 -07:00
Karoy Lorentey a8f8adedcb Merge pull request #623 from lorentey/equatable-indices
[ContainersPreview] Don’t require `Container.Index` to conform to `Comparable`
2026-04-20 10:37:17 -07:00
dependabot[bot] 27f54055aa 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.10 to 0.0.11.
- [Release notes](https://github.com/swiftlang/github-workflows/releases)
- [Commits](https://github.com/swiftlang/github-workflows/compare/0.0.10...0.0.11)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 06:23:49 +00:00
Karoy Lorentey 1c95e19aeb [ContainersPreview] Don’t require Container.Index to conform to Comparable
This slows down the default implementations of `distance(from:to:)` and `index(_:offsetBy:limitedBy:)`, but it allows linked lists to conform to `Container`. The trade off seems fair.

While we’re here, flesh out the `BidirectionalContainer` refinements a little, and add `Container.isEmpty` and `._custom[Last]IndexOfEquatableElement(_:)`.

This code is still untested.
2026-04-16 18:04:37 -07:00
Karoy Lorentey 9f0cf4be8b Merge pull request #622 from thisismanan/ordered-set-neg-fix
OrderedSet: Don't crash on negative capacity values
2026-04-16 14:47:49 -07:00
Manan 396577ca27 OrderedSet: Don't crash on negative capacity values
Fixes https://github.com/apple/swift-collections/issues/608, and starts behaving similar to Set()
2026-04-16 10:10:02 +05:30
Karoy Lorentey 181a432f74 Merge pull request #620 from apple/dependabot/github_actions/swiftlang/github-workflows/dot-github/workflows/soundness.yml-0.0.10
Bump swiftlang/github-workflows/.github/workflows/soundness.yml from 0.0.9 to 0.0.10
2026-04-15 15:44:46 -07:00
dependabot[bot] 5b04586a1c 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.9 to 0.0.10.
- [Release notes](https://github.com/swiftlang/github-workflows/releases)
- [Commits](https://github.com/swiftlang/github-workflows/compare/0.0.9...0.0.10)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-13 06:15:47 +00:00
Karoy Lorentey 23da1a4c41 Merge pull request #619 from lorentey/track-array-proposal
Track array proposal
2026-04-09 10:30:05 -07:00
Karoy Lorentey bf8441dc95 [BasicContainers] Fix typos in doc comments 2026-04-08 18:31:11 -07:00
Karoy Lorentey a9b64d4f09 [BasicContainers] RigidArray,UniqueArray: Add Equatable conformance on Swift 6.4
This is currently conditional on the UnstableContainersPreview trait. (Swift 6.4 has not shipped yet, so we cannot unconditionally enable this without risking breakage.)
2026-04-08 18:31:11 -07:00
Karoy Lorentey 917eead3cb [BasicContainers] RigidArray,UniqueArray: Add FIXME for Custom[Debug]StringConvertible conformances 2026-04-08 18:31:11 -07:00
Karoy Lorentey 7f4cebd2c5 BasicContainers] Add UniqueArray.isTriviallyIdentical(to:) 2026-04-08 18:31:10 -07:00
Karoy Lorentey b4bfd6d02e [BasicContainers] RigidArray.isTriviallyIdentical(to:): Don’t require Equatable elements, but do allow noncopyable ones 2026-04-08 18:31:07 -07:00
Karoy Lorentey 324c48ac6b Merge pull request #617 from lorentey/rigidly-enforced-lifetime-requirements
Fix lifetime requirements rigidly enforced in the latest nightlies
2026-04-03 17:38:32 -07:00
Karoy Lorentey 2417a006e2 Also adjust tests 2026-04-03 17:23:11 -07:00
Karoy Lorentey 35b7d8fba4 Fix lifetime requirements rigidly enforced in the latest nightlies 2026-04-03 17:01:36 -07:00
Karoy Lorentey 495d96d27d [ContainersPreview] Better illuminate the nextSpan problem on ContainerIterator 2026-04-03 09:01:48 -07:00
inju2403 9426246879 [OrderedCollections] Add OrderedDictionary.replaceElement(at:withKey:value:) 2026-04-03 16:55:14 +09:00
Mishal Shah 080a57943e Merge pull request #614 from apple/dependabot/github_actions/swiftlang/github-workflows/dot-github/workflows/soundness.yml-0.0.9
Bump swiftlang/github-workflows/.github/workflows/soundness.yml from 0.0.8 to 0.0.9
2026-04-02 16:43:33 -07:00
Karoy Lorentey 265fef259b Merge pull request #615 from apple/dependabot/github_actions/swiftlang/github-workflows/dot-github/workflows/swift_package_test.yml-0.0.9
Bump swiftlang/github-workflows/.github/workflows/swift_package_test.yml from 0.0.8 to 0.0.9
2026-04-02 15:33:35 -07:00
dependabot[bot] fb63a6735c 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.8 to 0.0.9.
- [Release notes](https://github.com/swiftlang/github-workflows/releases)
- [Commits](https://github.com/swiftlang/github-workflows/compare/0.0.8...0.0.9)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-02 21:56:08 +00:00
dependabot[bot] 2e756e628f 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.8 to 0.0.9.
- [Release notes](https://github.com/swiftlang/github-workflows/releases)
- [Commits](https://github.com/swiftlang/github-workflows/compare/0.0.8...0.0.9)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-02 21:56:06 +00:00
Karoy Lorentey 63bfbed01a Merge pull request #609 from natecook1000/borrowing-sequence-alignment
Align `BorrowingSequence` implementation with proposal
2026-03-27 15:25:42 -07:00
Karoy Lorentey e0ec6b0976 UniqueSet: Fix copypasta 2026-03-27 11:59:41 -07:00
Karoy Lorentey b9a926a2b1 Re-add line mistakenly deleted in RigidDequeTest 2026-03-27 11:56:08 -07:00
Karoy Lorentey 75b0309e12 Producer.skip(upTo:) → .skip(by:)
This is to align naming with BorrowingIteratorProtocol. The signatures are still different, as Producers may throw.
2026-03-27 11:52:05 -07:00
Karoy Lorentey 685ef74751 Fix {Rigid,Unique}{Set,Dictionary} 2026-03-27 11:47:03 -07:00
Karoy Lorentey f83e9b6538 Rename Collection.underestimatedCount_ 2026-03-27 11:47:00 -07:00
Karoy Lorentey 125dc93704 Add workflow to exercise UnstableHashedContainers trait
(In combination with UnstableContainersPreview, although we expect it to also work as a standalone setting.)
2026-03-27 11:46:57 -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 6b3b96763f Add workflow that performs a CMake build 2026-03-27 11:39:26 -05:00
Nate Cook 61fb6f5d13 Fix errant CMakeList renamings 2026-03-27 11:02:44 -05:00