Update dependency apple/swift-collections to from: "1.7.0" - #193
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
from: "1.6.0"→from: "1.7.0"Release Notes
apple/swift-collections (apple/swift-collections)
v1.7.0: Swift Collections 1.7.0Compare Source
This is a feature release raising the minimum required toolchain to Swift 6.2. It formalizes
Equatable/Hashableconformances on the ownership-aware container types, adds a new stableOrderedSetoperation, and continues to develop the experimental ownership-aware container model behind theUnstableContainersPreviewtrait. It also includes a number of performance improvements and bug fixes.New stable APIs
OrderedCollectionsOrderedSet.replace(at:with:)replaces the member at a given index with a new element, returning the element that was removed. Replacing a member with an element that already exists elsewhere in the set is a runtime error. Expected amortized O(1) complexity. (#669)BasicContainers,DequeModuleOn a Swift 6.4 or later toolchain,
RigidArray,UniqueArray,RigidDeque,UniqueDeque,RigidSet,UniqueSet,RigidDictionary, andUniqueDictionarynow formally conform toEquatableandHashable. (The underlying==andhash(into:)members were already available in 1.6.0; what is new is the conformances themselves.) Building with Swift 6.2 or 6.3 still gets you the==/hash(into:)members, but no conformances.RigidDeque.isTriviallyIdentical(to:)andUniqueDeque.isTriviallyIdentical(to:)are now available for every element type, including noncopyable ones. Previously these requiredElement: Equatable.New spelling for the capacity, cloning, and range-replacement operations; see Renamed APIs below. The new names are the stable spelling going forward; the old ones remain as deprecated shims.
Collectionsumbrella moduleThe
Collectionsmodule is back to re-exporting its constituent modules with@_exported import, instead of restating each type as apublic typealias(#716). A singleimport Collectionstherefore now brings in the entire contents ofBitCollections,DequeModule,HashTreeCollections,HeapModule, andOrderedCollections— including types that previously were not exposed in theCollectionsmodule, such asRigidDequeandUniqueDeque. This allowsimport Collectionsto work even for clients that haveMemberImportVisibilityenabled.Renamed APIs
BasicContainersandDequeModuleare stable modules, so every rename below ships with a deprecated shim carrying@available(*, deprecated, renamed:). Existing code keeps compiling, and Xcode/swift buildwill offer fix-its.reallocate(capacity:)setCapacity(_:)copy()clone()copy(capacity:)clone(capacity:)UniqueDeque.init(capacity:)init(minimumCapacity:)replace(_:with:)and friendsreplaceSubrange(_:copying:)/(_:moving:)/(_:consuming:)replace(_:count:initializingWith:)replaceSubrange(_:addingCount:initializingWith:)append(count:initializingWith:)append(addingCount:initializingWith:)insert(count:at:initializingWith:)insert(addingCount:at:initializingWith:)nextSpan(after:maximumCount:)nextSpan(after:maxCount:)nextMutableSpan(after:maximumCount:)nextMutableSpan(after:maxCount:)previousSpan(before:maximumCount:)previousSpan(before:maxCount:)RigidSet.insert(count:initializingWith:)insert(addingCount:initializingWith:)RigidSet.insert(count:from:)insert(addingCount:from:)Most of the new names sync this package with the API names recently adopted in the Standard Library in
IterableandUniqueArray.Performance improvements
BitSet.countis roughly 3× faster. (#702)_Word.allBitsis now@inlinable, which unblocks specialization in severalbit-twiddling paths. (#704)
OrderedSet.reverse()now reverses the hash table in place instead ofrebuilding it from scratch. (#668)
UniqueArrayno longer performs duplicate bounds checks on subscript andmutation paths. (#699)
RigidArray's internal representation was split from a(buffer pointer, count)pair into separate pointer, capacity, and count fields. This exposes an unused bit pattern for the compiler to use for representing nil values in optional wrapped arrays, avoiding having to add an out-of-line discriminator. The representation ofRigidDictionarywasadjusted in a similar way. (#692, #717)
Dequeand theTreeSet/TreeDictionarytypes are no longer using amalloc_sizeto make use of any "extra" storage allocated. (#700)OrderedDictionary.replaceElementnow usesexchange(_:with:)on its equal-key path to avoid copying the outgoing value. (#688, #703)RigidDictionarynow stores a sentinel value rather thannilfor its values pointer, removing a branch from value access.Notable bug fixes
BitCollections:BitSet.isEqualSet(to:)returned the wrong result when given an emptyRange<Int>. A non-empty bit set incorrectly compared equal to an empty range. (#718)SortedCollections(UnstableSortedCollectionstrait):SortedDictionary.Keys,.Values, and.SubSequencehad inverted==implementations, so equal instances compared unequal and vice versa.SubSequenceequality also now uses tuple comparison rather than an element-by-element loop with the wrong short-circuit. (#697)_UniqueCollectionfast paths inBitSet.isEqualSet(to:),OrderedSet.isEqualSet(to:),TreeSet.isEqualSet(to:), andTreeSet.symmetricDifference(_:)rely on dynamic conformance checks, which are unavailable in embedded Swift. They are now compiled out with#if !$Embedded. (#715)Experimental container protocols (
UnstableContainersPreviewtrait)This is the first swift-collections release that ships a fully operational container protocol hierarchy, including some massive updates. However, things are still subject to change, and we expect to need to make breaking changes as we gain experience using the new constructs. Nothing under this trait is stable API, and source-breaking changes land without deprecations.
New:
Documentation/Container-design.mdis a work-in-progress document describing the container design implemented in theContainersPreviewmodule. As of the 1.7.0 release, it explains some of the design decisions behind the container protocols, up to and includingMutableContainer. (TheProducerhierarchy and the range-replaceable container protocol family is not yet fully covered; we expect those parts to be fleshed out later.)New
SpanPreviewmoduleInputSpanhas moved out ofContainersPreviewinto a newSpanPreviewmodule.SpanPreviewholds span-adjacent primitives that are expected to graduate to the standard library, and it is entirely empty unless theUnstableContainersPreviewtrait is enabled. It also ships basicMutableSpan/OutputSpanhelpers for producing and consumingInputSpans.Some core APIs on the container types require the use of
InputSpan, and this change lets these APIs continue to live in their defining module.SpanPreviewis explicitly not part of the package's stable public API, as we expect to soon replace it with the Standard Library's ownInputSpandefinition.Dependency inversion
ContainersPreviewand the concrete container modules have swapped places in the dependency graph.BasicContainersandDequeModuleno longer depend onContainersPreview; insteadContainersPreviewdepends on them, and allcontainer conformances for the concrete types now live there, under
Sources/ContainersPreview/Conformances/. (842f125c)Source-breaking for trait adopters: getting
Container(etc.) conformances forRigidArray,UniqueArray,RigidDeque,UniqueDeque,RigidSet, orUniqueSetnow requiresimport ContainersPreview. Importing justBasicContainersorDequeModulegets you the types and their intrinsic operations, but not the protocol conformances.Standard library adoption
BorrowingSequence_/BorrowingIteratorProtocol_protocols have been replaced by the standard library'sIterableandBorrowingIteratorProtocol. The package's own definitions have been removed. (#657)RefandMutableRefnow ship in the Standard Library rather than being declared inContainersPreview. (UniqueBoxis part of the package's stable API, so its definition continues to remain available. We expect to deprecate it in a future package release.)New protocols
RangeReplaceableContainerinto the new parent protocolDrainableContainer. This protocol models containers supporting partial in-place consumption (and removal) of their contents. Range-replacement operations now all return indices to the subranges they affected, so that we can perform insertions/removals without losing our place in the container. (This is particularly important for linked lists and similar linked data structures capable of performing O(1) insertions/removals.) (#723)CountedProducerrefinesProduceradding a precise count of remaining elements.Drainnow refinesCountedProducer.ContainerDrainrefinesDrainto allow retrieving a valid index after the items have been drained.RangeExpression2now refines the standardRangeExpression, so that we can use the standard range expression notation over container types. (The name (as well as the protocol itself) is a placeholder, so that we have something that works while we are looking for a better solution.) (#22a94a97)Reworked core requirements
Container's core primitive is nownextSpan(after:maxCount:limitedBy:), with optional delimiter arguments; thebidirectional counterpart is
spanBoundary(before:maxDistance:limitedBy:).ContainergainedmakeBorrowingIterator(from:),makeBorrowingIterator(from:to:), andcurrentIndex(of:)requirements.Containernow expects its indices to beComparableagain, as we have found a way to provide them in conforming linked list types. (#727)[Mutable]Containergained subscript requirements expressed with borrow and mutate accessors.Producer.generate(into:)switched to saturating semantics — it now fills the destination when possible, unless it reaches its end or throws. (#728)New algorithms
MutableContainergained bulk update operations (updateSubrangeand friends), in both mutating and copying forms, plus a defaultswapAtimplementation for copyable elements. (#724)PermutableContainergainedreverse(),shuffle(),moveSubrange(_:to:), and a heap sort.ProducergainedUnfoldProducer(an unfold-style generator), andBorrowingIteratorProtocolgainedmapError, andmapwas fixed;_map2and_map3were added alongside it to demonstrate different throwing behaviors. Error handling across the producer/drain algorithms was reviewed.Containerconformances forSpan,MutableSpan,OutputSpan, andInputSpan.Experimental hashed containers (
UnstableHashedContainerstrait)These types are functional, but they still have known usability gaps in their API surface that prevents us from declaring them API stable.
UnstableContainersPreviewto be enabled alongside it.70dc2389)RigidSetandUniqueSetnow conform toContainer. (#713)RigidDictionaryandUniqueDictionarygained akeysproperty andmutableValue(forKey:), which yields in-place mutable access to a stored value. (#698,Testing and infrastructure
checkSetAlgebra, a new law checker in_CollectionsTestSupport, verifies set-like types against theSetAlgebralaws — and additionally checks each mutating operation against its non-mutating twin. (#719, #730)Containerconformance validator has been added, along the lines of the existingSequence/Collectionconformance checkers, and is now applied toRigidSet,UniqueSet,RigidDeque, andUniqueDeque. (#713, #720)Deque's storage allocation behavior andMutableContainer's requirements (the latter uncovered and fixed several issues). (#722)swift-formatconfiguration for this package.swiftlang/github-workflows0.0.11 → 0.0.15,actions/checkout6 → 7), and the matrix was simplified now that 6.0/6.1 are out of support.Detailed List of Changes
BorrowingSequencetoIterableby @natecook1000 in #657_Word.allBitsas@inlinableby @dnadoba in #704BitSet.countperformance by ~3x by @dnadoba in #702_UniqueCollectionfast paths in embedded Swift by @lorentey in #715Producer.generate(into:): Switch to saturating semantics by @lorentey in #728New Contributors
Full Changelog: apple/swift-collections@1.6.0...1.7.0
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.