From 6cb037037d45f78622fd7cab3f62e3c6a4ff5ddb Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Mon, 23 May 2022 16:17:35 -0700 Subject: [PATCH 01/15] [OrderedDictionary][doc] Update docs for merge/filter operations Resolves #145 --- .../OrderedDictionary/OrderedDictionary.swift | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift index 1fe94039..ad953fa0 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift @@ -767,14 +767,18 @@ extension OrderedDictionary { /// /// // Keeping existing value for key "a": /// dictionary.merge(zip(["a", "c"], [3, 4])) { (current, _) in current } - /// // ["b": 2, "a": 1, "c": 4] + /// // ["a": 1, "b": 2, "c": 4] /// /// // Taking the new value for key "a": /// dictionary.merge(zip(["a", "d"], [5, 6])) { (_, new) in new } - /// // ["b": 2, "a": 5, "c": 4, "d": 6] + /// // ["a": 5, "b": 2, "c": 4, "d": 6] + /// + /// This operation preserves the order of keys in the original dictionary. + /// New key-value pairs are appended to the end in the order they appear in + /// the given sequence. /// /// - Parameters: - /// - other: A sequence of key-value pairs. + /// - keysAndValues: A sequence of key-value pairs. /// - combine: A closure that takes the current and new values for any /// duplicate keys. The closure returns the desired value for the final /// dictionary. @@ -813,14 +817,18 @@ extension OrderedDictionary { /// /// // Keeping existing value for key "a": /// dictionary.merge(zip(["a", "c"], [3, 4])) { (current, _) in current } - /// // ["b": 2, "a": 1, "c": 4] + /// // ["a": 1, "b": 2, "c": 4] /// /// // Taking the new value for key "a": /// dictionary.merge(zip(["a", "d"], [5, 6])) { (_, new) in new } - /// // ["b": 2, "a": 5, "c": 4, "d": 6] + /// // ["a": 5, "b": 2, "c": 4, "d": 6] + /// + /// This operation preserves the order of keys in the original dictionary. + /// New key-value pairs are appended to the end in the order they appear in + /// the given sequence. /// /// - Parameters: - /// - other: A sequence of key-value pairs. + /// - keysAndValues: A sequence of key-value pairs. /// - combine: A closure that takes the current and new values for any /// duplicate keys. The closure returns the desired value for the final /// dictionary. @@ -854,9 +862,9 @@ extension OrderedDictionary { /// let newKeyValues = zip(["a", "b"], [3, 4]) /// /// let keepingCurrent = dictionary.merging(newKeyValues) { (current, _) in current } - /// // ["b": 2, "a": 1] + /// // ["a": 1, "b": 2] /// let replacingCurrent = dictionary.merging(newKeyValues) { (_, new) in new } - /// // ["b": 4, "a": 3] + /// // ["a": 3, "b": 4] /// /// - Parameters: /// - other: A sequence of key-value pairs. @@ -865,7 +873,9 @@ extension OrderedDictionary { /// dictionary. /// /// - Returns: A new dictionary with the combined keys and values of this - /// dictionary and `other`. + /// dictionary and `other`. The order of keys in the result dictionary + /// matches that of `self`, with additional key-value pairs (if any) + /// appended at the end in the order they appear in `other`. /// /// - Complexity: Expected to be O(`count` + *n*) on average, where *n* is the /// number of elements in `keysAndValues`, if `Key` implements high-quality @@ -897,9 +907,9 @@ extension OrderedDictionary { /// let newKeyValues = zip(["a", "b"], [3, 4]) /// /// let keepingCurrent = dictionary.merging(newKeyValues) { (current, _) in current } - /// // ["b": 2, "a": 1] + /// // ["a": 1, "b": 2] /// let replacingCurrent = dictionary.merging(newKeyValues) { (_, new) in new } - /// // ["b": 4, "a": 3] + /// // ["a": 3, "b": 4] /// /// - Parameters: /// - other: A sequence of key-value pairs. @@ -908,7 +918,9 @@ extension OrderedDictionary { /// dictionary. /// /// - Returns: A new dictionary with the combined keys and values of this - /// dictionary and `other`. + /// dictionary and `other`. The order of keys in the result dictionary + /// matches that of `self`, with additional key-value pairs (if any) + /// appended at the end in the order they appear in `other`. /// /// - Complexity: Expected to be O(`count` + *n*) on average, where *n* is the /// number of elements in `keysAndValues`, if `Key` implements high-quality @@ -932,7 +944,8 @@ extension OrderedDictionary { /// argument and returns a Boolean value indicating whether the pair /// should be included in the returned dictionary. /// - /// - Returns: A dictionary of the key-value pairs that `isIncluded` allows. + /// - Returns: A dictionary of the key-value pairs that `isIncluded` allows, + /// in the same order that they appear in `self`. /// /// - Complexity: O(`count`) @inlinable @@ -956,7 +969,7 @@ extension OrderedDictionary { /// accepts each value of the dictionary as its parameter and returns a /// transformed value of the same or of a different type. /// - Returns: A dictionary containing the keys and transformed values of - /// this dictionary. + /// this dictionary, in the same order. /// /// - Complexity: O(`count`) @inlinable @@ -991,7 +1004,7 @@ extension OrderedDictionary { /// optional transformed value of the same or of a different type. /// /// - Returns: A dictionary containing the keys and non-`nil` transformed - /// values of this dictionary. + /// values of this dictionary, in the same order. /// /// - Complexity: O(`count`) @inlinable From 3c856903e509a90aaf9fef383e7d941b3b15e912 Mon Sep 17 00:00:00 2001 From: Hector Matos Date: Tue, 2 Aug 2022 16:44:59 -0500 Subject: [PATCH 02/15] Delete .swiftpm directory (cherry picked from commit 480b0af0109990a61ef41bf75e6137615c11480f) --- .../contents.xcworkspacedata | 7 - .../xcschemes/Collections.xcscheme | 91 ---------- .../xcschemes/DequeModule.xcscheme | 81 --------- .../xcschemes/OrderedCollections.xcscheme | 81 --------- .../swift-collections-Package.xcscheme | 170 ------------------ 5 files changed, 430 deletions(-) delete mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata delete mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/Collections.xcscheme delete mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/DequeModule.xcscheme delete mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/OrderedCollections.xcscheme delete mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/swift-collections-Package.xcscheme diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a6..00000000 --- a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/Collections.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Collections.xcscheme deleted file mode 100644 index a3e92863..00000000 --- a/.swiftpm/xcode/xcshareddata/xcschemes/Collections.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/DequeModule.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/DequeModule.xcscheme deleted file mode 100644 index 89302646..00000000 --- a/.swiftpm/xcode/xcshareddata/xcschemes/DequeModule.xcscheme +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/OrderedCollections.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/OrderedCollections.xcscheme deleted file mode 100644 index 8e6cad97..00000000 --- a/.swiftpm/xcode/xcshareddata/xcschemes/OrderedCollections.xcscheme +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/swift-collections-Package.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/swift-collections-Package.xcscheme deleted file mode 100644 index ee12b5ed..00000000 --- a/.swiftpm/xcode/xcshareddata/xcschemes/swift-collections-Package.xcscheme +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 85576263f60452f85a099c3decc093cabbedad9e Mon Sep 17 00:00:00 2001 From: Hector Matos Date: Tue, 2 Aug 2022 16:46:27 -0500 Subject: [PATCH 03/15] Update .gitignore (cherry picked from commit 7016a13f0e8d0d0a36f3566a6dc6acaf5b83fbf4) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4b8a5292..f0e519a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +/.swiftpm /.build /Packages /*.xcodeproj From 8611b32dfefe673f009da030f19b8eceb47b3a15 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Wed, 3 Aug 2022 12:14:26 -0700 Subject: [PATCH 04/15] Set up shared schemes in the xcworkspace under Utils/ (cherry picked from commit 3fce10a45afb730200d70c5356d7815fc97ca1a8) --- .../xcschemes/Collections.xcscheme | 70 +++++ .../xcschemes/CollectionsBenchmark.xcscheme | 81 ++++++ .../xcschemes/CollectionsTestSupport.xcscheme | 78 ++++++ .../xcschemes/DequeModule.xcscheme | 70 +++++ .../xcschemes/OrderedCollections.xcscheme | 70 +++++ .../xcschemes/PriorityQueueModule.xcscheme | 70 +++++ .../xcshareddata/xcschemes/benchmark.xcscheme | 81 ++++++ .../swift-collections-Package.xcscheme | 260 ++++++++++++++++++ ...ift-collections-benchmark-Package.xcscheme | 100 +++++++ 9 files changed, 880 insertions(+) create mode 100644 Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme create mode 100644 Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/CollectionsBenchmark.xcscheme create mode 100644 Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/CollectionsTestSupport.xcscheme create mode 100644 Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/DequeModule.xcscheme create mode 100644 Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/OrderedCollections.xcscheme create mode 100644 Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/PriorityQueueModule.xcscheme create mode 100644 Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/benchmark.xcscheme create mode 100644 Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-Package.xcscheme create mode 100644 Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-benchmark-Package.xcscheme diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme new file mode 100644 index 00000000..524f681f --- /dev/null +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/CollectionsBenchmark.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/CollectionsBenchmark.xcscheme new file mode 100644 index 00000000..461eb642 --- /dev/null +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/CollectionsBenchmark.xcscheme @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/CollectionsTestSupport.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/CollectionsTestSupport.xcscheme new file mode 100644 index 00000000..eff5e75b --- /dev/null +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/CollectionsTestSupport.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/DequeModule.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/DequeModule.xcscheme new file mode 100644 index 00000000..02171f2c --- /dev/null +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/DequeModule.xcscheme @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/OrderedCollections.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/OrderedCollections.xcscheme new file mode 100644 index 00000000..07004490 --- /dev/null +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/OrderedCollections.xcscheme @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/PriorityQueueModule.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/PriorityQueueModule.xcscheme new file mode 100644 index 00000000..d4788ae3 --- /dev/null +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/PriorityQueueModule.xcscheme @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/benchmark.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/benchmark.xcscheme new file mode 100644 index 00000000..6b143694 --- /dev/null +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/benchmark.xcscheme @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-Package.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-Package.xcscheme new file mode 100644 index 00000000..7016aa95 --- /dev/null +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-Package.xcscheme @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-benchmark-Package.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-benchmark-Package.xcscheme new file mode 100644 index 00000000..a4191ca5 --- /dev/null +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-benchmark-Package.xcscheme @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From b816872d24034cdcfc04239f225a138cec2d78c6 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Wed, 3 Aug 2022 12:15:12 -0700 Subject: [PATCH 05/15] swift-collections.xcworkspace: Update dependencies (cherry picked from commit 00a99aa77c4982a6e7343982220e44b15e4d5974) --- .../xcshareddata/swiftpm/Package.resolved | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Utils/swift-collections.xcworkspace/xcshareddata/swiftpm/Package.resolved index a982563b..dce13b01 100644 --- a/Utils/swift-collections.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Utils/swift-collections.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/apple/swift-argument-parser", "state": { "branch": null, - "revision": "986d191f94cec88f6350056da59c2e59e83d1229", - "version": "0.4.3" + "revision": "df9ee6676cd5b3bf5b330ec7568a5644f547201b", + "version": "1.1.3" } }, { @@ -15,8 +15,8 @@ "repositoryURL": "https://github.com/apple/swift-system", "state": { "branch": null, - "revision": "2bc160bfe34d843ae5ff47168080add24dfd7eac", - "version": "0.0.2" + "revision": "39774ef16a6d91dee6f666b940e00ea202710cf7", + "version": "0.0.3" } } ] From 4908474e3016aa33b68d0d01e58ba30b6d4304fb Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Wed, 31 Aug 2022 17:06:34 -0700 Subject: [PATCH 06/15] Fixup schemes --- .../xcschemes/Collections.xcscheme | 33 ++++++- .../xcschemes/DequeModule.xcscheme | 3 +- .../xcschemes/OrderedCollections.xcscheme | 13 ++- .../xcschemes/PriorityQueueModule.xcscheme | 70 --------------- .../swift-collections-Package.xcscheme | 85 ++----------------- 5 files changed, 51 insertions(+), 153 deletions(-) delete mode 100644 Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/PriorityQueueModule.xcscheme diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme index 524f681f..6cf1b9b5 100644 --- a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme @@ -26,8 +26,39 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> + + + + + + + + + + + + + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/OrderedCollections.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/OrderedCollections.xcscheme index 07004490..035f4ee0 100644 --- a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/OrderedCollections.xcscheme +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/OrderedCollections.xcscheme @@ -26,8 +26,19 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-Package.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-Package.xcscheme index 7016aa95..81438290 100644 --- a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-Package.xcscheme +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-Package.xcscheme @@ -6,20 +6,6 @@ parallelizeBuildables = "YES" buildImplicitDependencies = "YES"> - - - - - - - - - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> - - - - - - - - From ac20a2c31de398f195873cc6332388f702982e9e Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Wed, 17 Aug 2022 13:56:03 -0700 Subject: [PATCH 07/15] [Xcode] Update schemes & file template Update Collections scheme with support for testing. Update the copyright year in file template. (cherry picked from commit 3437abecc49cfbbb91893e3a0d0f124db163637f) --- .../xcshareddata/IDETemplateMacros.plist | 2 +- .../xcschemes/Collections.xcscheme | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/IDETemplateMacros.plist b/Utils/swift-collections.xcworkspace/xcshareddata/IDETemplateMacros.plist index 530bfe83..26d96226 100644 --- a/Utils/swift-collections.xcworkspace/xcshareddata/IDETemplateMacros.plist +++ b/Utils/swift-collections.xcworkspace/xcshareddata/IDETemplateMacros.plist @@ -7,7 +7,7 @@ // // This source file is part of the Swift Collections open source project // -// Copyright (c) 2021 Apple Inc. and the Swift project authors +// Copyright (c) 2022 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme index 6cf1b9b5..87bb7432 100644 --- a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme @@ -20,6 +20,48 @@ ReferencedContainer = "container:.."> + + + + + + + + + + + + Date: Wed, 17 Aug 2022 13:52:00 -0700 Subject: [PATCH 08/15] [OrderedCollection] Use standard temp allocation facility, if available The 5.6 stdlib introduced a new facility for temporary allocations that promises better performance than direct allocations. Use it when the toolchain version is above 5.6. (cherry picked from commit ddb6d141b3e4e8726a15e3e9e916ee697bd310db) --- .../OrderedCollections/Utilities/_UnsafeBitset.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/OrderedCollections/Utilities/_UnsafeBitset.swift b/Sources/OrderedCollections/Utilities/_UnsafeBitset.swift index 9470c610..aa10c684 100644 --- a/Sources/OrderedCollections/Utilities/_UnsafeBitset.swift +++ b/Sources/OrderedCollections/Utilities/_UnsafeBitset.swift @@ -73,6 +73,15 @@ extension _UnsafeBitset { run body: (inout _UnsafeBitset) throws -> Void ) rethrows { let wordCount = _UnsafeBitset.wordCount(forCapacity: capacity) +#if compiler(>=5.6) + return try withUnsafeTemporaryAllocation( + of: Word.self, capacity: wordCount + ) { words in + words.initialize(repeating: .empty) + var bitset = Self(words: words, count: 0) + return try body(&bitset) + } +#else if wordCount <= 2 { var buffer: (Word, Word) = (.empty, .empty) return try withUnsafeMutablePointer(to: &buffer) { p in @@ -87,6 +96,7 @@ extension _UnsafeBitset { defer { words.deallocate() } var bitset = _UnsafeBitset(words: words, count: 0) return try body(&bitset) +#endif } } From 6cbecdb467228ead02c6821b4fb1fba5a1e733ca Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Wed, 17 Aug 2022 17:37:14 -0700 Subject: [PATCH 09/15] [OrderedSet] Work around weird name lookup issue in compiler Resolves #157. (cherry picked from commit 1071b372942289dbd3209ede40f613d339cca8e1) --- .../OrderedSet/OrderedSet+UnorderedView.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift index b0222a64..c84ee9c5 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift @@ -14,8 +14,6 @@ extension OrderedSet { /// conformance. @frozen public struct UnorderedView { - public typealias Element = OrderedSet.Element - @usableFromInline internal var _base: OrderedSet @@ -138,7 +136,9 @@ extension OrderedSet.UnorderedView: ExpressibleByArrayLiteral { } } -extension OrderedSet.UnorderedView: SetAlgebra {} +extension OrderedSet.UnorderedView: SetAlgebra { + public typealias Element = OrderedSet.Element +} extension OrderedSet.UnorderedView { /// Creates an empty set. @@ -302,7 +302,7 @@ extension OrderedSet.UnorderedView { @inlinable @inline(__always) @discardableResult - public mutating func remove(_ member: Self.Element) -> Self.Element? { + public mutating func remove(_ member: Element) -> Element? { _base.remove(member) } } From 87c78de6b48fcfaea7eaefd3e8a2ad2eac2ed636 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Wed, 31 Aug 2022 13:53:52 -0700 Subject: [PATCH 10/15] =?UTF-8?q?[Deque]=20Force-inline=20the=20subscript?= =?UTF-8?q?=E2=80=99s=20=5Fmodify=20accessor=20to=20work=20around=20a=20pe?= =?UTF-8?q?rformance=20issue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves #164. (cherry picked from commit 98cd75386634e3b8ffdba64eee93fd5b5a6a732d) --- Sources/DequeModule/Deque+Collection.swift | 33 ++++++++++++++-------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/Sources/DequeModule/Deque+Collection.swift b/Sources/DequeModule/Deque+Collection.swift index 61ba34a2..a5b8c334 100644 --- a/Sources/DequeModule/Deque+Collection.swift +++ b/Sources/DequeModule/Deque+Collection.swift @@ -359,25 +359,36 @@ extension Deque: RandomAccessCollection { handle.ptr(at: slot).pointee = newValue } } + @inline(__always) // https://github.com/apple/swift-collections/issues/164 _modify { precondition(index >= 0 && index < count, "Index out of bounds") - _storage.ensureUnique() - // We technically aren't supposed to escape storage pointers out of a - // managed buffer, so we escape a `(slot, value)` pair instead, leaving - // the corresponding slot temporarily uninitialized. - var (slot, value) = _storage.update { handle -> (_Slot, Element) in - let slot = handle.slot(forOffset: index) - return (slot, handle.ptr(at: slot).move()) - } + var (slot, value) = _prepareForModify(at: index) defer { - _storage.update { handle in - handle.ptr(at: slot).initialize(to: value) - } + _finalizeModify(slot, value) } yield &value } } + @inlinable + internal mutating func _prepareForModify(at index: Int) -> (_Slot, Element) { + _storage.ensureUnique() + // We technically aren't supposed to escape storage pointers out of a + // managed buffer, so we escape a `(slot, value)` pair instead, leaving + // the corresponding slot temporarily uninitialized. + return _storage.update { handle in + let slot = handle.slot(forOffset: index) + return (slot, handle.ptr(at: slot).move()) + } + } + + @inlinable + internal mutating func _finalizeModify(_ slot: _Slot, _ value: Element) { + _storage.update { handle in + handle.ptr(at: slot).initialize(to: value) + } + } + /// Accesses a contiguous subrange of the deque's elements. /// /// - Parameters: From d5bd858758cf482c95db853513a7c1f9e857d14f Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Wed, 31 Aug 2022 13:54:43 -0700 Subject: [PATCH 11/15] [Deque] Fix testing in DequeModule.xcscheme (cherry picked from commit 0a263622263751f1bd877ca79714738159ade929) --- .../xcschemes/DequeModule.xcscheme | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/DequeModule.xcscheme b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/DequeModule.xcscheme index 4b527579..3e6ac8b4 100644 --- a/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/DequeModule.xcscheme +++ b/Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/DequeModule.xcscheme @@ -20,6 +20,20 @@ ReferencedContainer = "container:.."> + + + + + + + + Date: Wed, 31 Aug 2022 14:59:50 -0700 Subject: [PATCH 12/15] =?UTF-8?q?[Deque]=20Add=20direct=20benchmarks=20for?= =?UTF-8?q?=20indexing=20subscript=E2=80=99s=20=5Fmodify=20accessor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit c82261a5298103c643cb4315c4432214cdb5ea0e) --- Benchmarks/Benchmarks/DequeBenchmarks.swift | 30 +++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Benchmarks/Benchmarks/DequeBenchmarks.swift b/Benchmarks/Benchmarks/DequeBenchmarks.swift index b801934f..7f916254 100644 --- a/Benchmarks/Benchmarks/DequeBenchmarks.swift +++ b/Benchmarks/Benchmarks/DequeBenchmarks.swift @@ -171,6 +171,36 @@ extension Benchmark { } } + self.add( + title: "Deque modify through subscript (contiguous)", + input: ([Int], [Int]).self + ) { input, lookups in + return { timer in + var deque = Deque(input) + timer.measure { + for i in lookups { + deque[i] += 1 + } + } + blackHole(deque) + } + } + + self.add( + title: "Deque modify through subscript (discontiguous)", + input: ([Int], [Int]).self + ) { input, lookups in + return { timer in + var deque = Deque(discontiguous: input) + timer.measure { + for i in lookups { + deque[i] += 1 + } + } + blackHole(deque) + } + } + self.add( title: "Deque random swaps (contiguous)", input: [Int].self From b379fa7aee604738bd0b4076984c934e242bb7a5 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Wed, 31 Aug 2022 15:31:42 -0700 Subject: [PATCH 13/15] [OrderedCollections] Force-inline all _modify accessors (cherry picked from commit ee1b2de06edf18545084d99a5c99995e9c1ff8d4) --- .../HashTable/_HashTable.swift | 1 + .../OrderedDictionary+Elements.swift | 2 + .../OrderedDictionary+Values.swift | 1 + .../OrderedDictionary/OrderedDictionary.swift | 117 ++++++++++++------ .../OrderedSet/OrderedSet+UnorderedView.swift | 2 +- .../OrderedSet+UnstableInternals.swift | 2 +- .../OrderedSet/OrderedSet.swift | 1 + 7 files changed, 83 insertions(+), 43 deletions(-) diff --git a/Sources/OrderedCollections/HashTable/_HashTable.swift b/Sources/OrderedCollections/HashTable/_HashTable.swift index 7faa5344..319a65ff 100644 --- a/Sources/OrderedCollections/HashTable/_HashTable.swift +++ b/Sources/OrderedCollections/HashTable/_HashTable.swift @@ -170,6 +170,7 @@ extension _HashTable { @inlinable internal var header: Header { get { _storage.header } + @inline(__always) // https://github.com/apple/swift-collections/issues/164 nonmutating _modify { yield &_storage.header } } diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift index d0507640..50116a81 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift @@ -35,6 +35,7 @@ extension OrderedDictionary { get { Elements(_base: self) } + @inline(__always) // https://github.com/apple/swift-collections/issues/164 _modify { var elements = Elements(_base: self) self = Self() @@ -63,6 +64,7 @@ extension OrderedDictionary.Elements { get { _base.values } + @inline(__always) // https://github.com/apple/swift-collections/issues/164 _modify { var values = OrderedDictionary.Values(_base: _base) self = Self(_base: .init()) diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift index 3e5c822c..7181fe61 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift @@ -283,6 +283,7 @@ extension OrderedDictionary.Values: MutableCollection { get { _base._values[position] } + @inline(__always) // https://github.com/apple/swift-collections/issues/164 _modify { yield &_base._values[position] } diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift index ad953fa0..44c56e9a 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift @@ -238,6 +238,7 @@ extension OrderedDictionary { @inline(__always) public var values: Values { get { Values(_base: self) } + @inline(__always) // https://github.com/apple/swift-collections/issues/164 _modify { var values = Values(_base: self) self = [:] @@ -367,41 +368,59 @@ extension OrderedDictionary { } _checkInvariants() } + @inline(__always) // https://github.com/apple/swift-collections/issues/164 _modify { - let (index, bucket) = _keys._find(key) - - // To support in-place mutations better, we swap the value to the end of - // the array, pop it off, then put things back in place when we're done. - var value: Value? = nil - if let index = index { - _values.swapAt(index, _values.count - 1) - value = _values.removeLast() - } - + var value: Value? + let (index, bucket) = _prepareForKeyingModify(key, &value) defer { - switch (index, value) { - case let (index?, value?): // Assign - _values.append(value) - _values.swapAt(index, _values.count - 1) - case let (index?, nil): // Remove - if index < _values.count { - let standin = _values.remove(at: index) - _values.append(standin) - } - _keys._removeExistingMember(at: index, in: bucket) - case let (nil, value?): // Insert - _keys._appendNew(key, in: bucket) - _values.append(value) - case (nil, nil): // Noop - break - } - _checkInvariants() + _finalizeKeyingModify(key, index, bucket, &value) } - yield &value } } + @inlinable + internal mutating func _prepareForKeyingModify( + _ key: Key, + _ value: inout Value? + ) -> (index: Int?, bucket: _HashTable.Bucket) { + let (index, bucket) = _keys._find(key) + + // To support in-place mutations better, we swap the value to the end of + // the array, pop it off, then put things back in place when we're done. + if let index = index { + _values.swapAt(index, _values.count - 1) + value = _values.removeLast() + } + return (index, bucket) + } + + @inlinable + internal mutating func _finalizeKeyingModify( + _ key: Key, + _ index: Int?, + _ bucket: _HashTable.Bucket, + _ value: inout Value? + ) { + switch (index, value) { + case let (index?, value?): // Assign + _values.append(value) + _values.swapAt(index, _values.count - 1) + case let (index?, nil): // Remove + if index < _values.count { + let standin = _values.remove(at: index) + _values.append(standin) + } + _keys._removeExistingMember(at: index, in: bucket) + case let (nil, value?): // Insert + _keys._appendNew(key, in: bucket) + _values.append(value) + case (nil, nil): // Noop + break + } + _checkInvariants() + } + /// Accesses the value with the given key. If the dictionary doesn't contain /// the given key, accesses the provided default value as if the key and /// default value existed in the dictionary. @@ -472,26 +491,42 @@ extension OrderedDictionary { guard let offset = _keys.firstIndex(of: key) else { return defaultValue() } return _values[offset] } + @inline(__always) // https://github.com/apple/swift-collections/issues/164 _modify { - let (inserted, index) = _keys.append(key) - if inserted { - assert(index == _values.count) - _values.append(defaultValue()) - } - var value: Value = _values.withUnsafeMutableBufferPointer { buffer in - assert(index < buffer.count) - return (buffer.baseAddress! + index).move() - } + var (index, value) = _prepareForDefaultedModify(key, defaultValue) defer { - _values.withUnsafeMutableBufferPointer { buffer in - assert(index < buffer.count) - (buffer.baseAddress! + index).initialize(to: value) - } + _finalizeDefaultedModify(index, &value) } yield &value } } + @inlinable + internal mutating func _prepareForDefaultedModify( + _ key: Key, + _ defaultValue: () -> Value + ) -> (index: Int, value: Value) { + let (inserted, index) = _keys.append(key) + if inserted { + assert(index == _values.count) + _values.append(defaultValue()) + } + let value: Value = _values.withUnsafeMutableBufferPointer { buffer in + assert(index < buffer.count) + return (buffer.baseAddress! + index).move() + } + return (index, value) + } + + @inlinable + internal mutating func _finalizeDefaultedModify( + _ index: Int, _ value: inout Value + ) { + _values.withUnsafeMutableBufferPointer { buffer in + assert(index < buffer.count) + (buffer.baseAddress! + index).initialize(to: value) + } + } } extension OrderedDictionary { diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift index c84ee9c5..88216a6d 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift @@ -52,7 +52,7 @@ extension OrderedSet { get { UnorderedView(_base: self) } - @inline(__always) + @inline(__always) // https://github.com/apple/swift-collections/issues/164 _modify { var view = UnorderedView(_base: self) self = OrderedSet() diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+UnstableInternals.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+UnstableInternals.swift index 0243b3c1..7896d0cd 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+UnstableInternals.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+UnstableInternals.swift @@ -37,7 +37,7 @@ extension OrderedSet { _UnstableInternals(self) } - @inline(__always) + @inline(__always) // https://github.com/apple/swift-collections/issues/164 _modify { var view = _UnstableInternals(self) self = OrderedSet() diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet.swift index 9e3965bb..83ca98a3 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet.swift @@ -286,6 +286,7 @@ extension OrderedSet { set { self = .init(newValue) } + @inline(__always) // https://github.com/apple/swift-collections/issues/164 _modify { var members = Array(_elements) _elements = [] From 71aa4a39ae59addf40e9dd40e79a4968f1c857cc Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Wed, 31 Aug 2022 17:57:24 -0700 Subject: [PATCH 14/15] [OrderedDictionary] Resolve spurious(?) call-site ambiguities --- .../OrderedDictionary+Initializers.swift | 3 + .../OrderedDictionary/OrderedDictionary.swift | 2 + .../OrderedDictionary Tests.swift | 70 +++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Initializers.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Initializers.swift index 55332bbb..93352ef7 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Initializers.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Initializers.swift @@ -75,6 +75,7 @@ extension OrderedDictionary { /// /// - Complexity: Expected O(*n*) on average, where *n* is the count if /// key-value pairs, if `Key` implements high-quality hashing. + @_disfavoredOverload // https://github.com/apple/swift-collections/issues/125 @inlinable public init( uniqueKeysWithValues keysAndValues: S @@ -195,6 +196,7 @@ extension OrderedDictionary { /// /// - Complexity: Expected O(*n*) on average, where *n* is the count of /// key-value pairs, if `Key` implements high-quality hashing. + @_disfavoredOverload // https://github.com/apple/swift-collections/issues/125 @inlinable @inline(__always) public init( @@ -368,6 +370,7 @@ extension OrderedDictionary { /// /// - Complexity: Expected O(*n*) on average, where *n* is the count if /// key-value pairs, if `Key` implements high-quality hashing. + @_disfavoredOverload // https://github.com/apple/swift-collections/issues/125 @inlinable public init( uncheckedUniqueKeysWithValues keysAndValues: S diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift index ad953fa0..4c4e0d00 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift @@ -785,6 +785,7 @@ extension OrderedDictionary { /// /// - Complexity: Expected to be O(*n*) on average, where *n* is the number of /// elements in `keysAndValues`, if `Key` implements high-quality hashing. + @_disfavoredOverload // https://github.com/apple/swift-collections/issues/125 @inlinable public mutating func merge( _ keysAndValues: __owned S, @@ -880,6 +881,7 @@ extension OrderedDictionary { /// - Complexity: Expected to be O(`count` + *n*) on average, where *n* is the /// number of elements in `keysAndValues`, if `Key` implements high-quality /// hashing. + @_disfavoredOverload // https://github.com/apple/swift-collections/issues/125 @inlinable public __consuming func merging( _ other: __owned S, diff --git a/Tests/OrderedCollectionsTests/OrderedDictionary/OrderedDictionary Tests.swift b/Tests/OrderedCollectionsTests/OrderedDictionary/OrderedDictionary Tests.swift index d74192b3..2ede2d57 100644 --- a/Tests/OrderedCollectionsTests/OrderedDictionary/OrderedDictionary Tests.swift +++ b/Tests/OrderedCollectionsTests/OrderedDictionary/OrderedDictionary Tests.swift @@ -1290,5 +1290,75 @@ class OrderedDictionaryTests: CollectionTestCase { } } + func test_uniqueKeysWithValues_initializer_ambiguity() { + // https://github.com/apple/swift-collections/issues/125 + + let names = ["dylan", "bob", "aaron", "carol"] + let expected = names.map { (key: $0, value: 0) } + + let d1 = OrderedDictionary(uniqueKeysWithValues: names.map { ($0, 0) }) + expectEqualElements(d1, expected) + + let d2 = OrderedDictionary( + uniqueKeysWithValues: ["dylan", "bob", "aaron", "carol"].map { ($0, 0) }) + expectEqualElements(d2, expected) + + let d3 = OrderedDictionary( + uniqueKeysWithValues: names.map { (key: $0, value: 0) }) + expectEqualElements(d3, expected) + + let d4 = OrderedDictionary( + uniqueKeysWithValues: ["dylan", "bob", "aaron", "carol"].map { (key: $0, value: 0) }) + expectEqualElements(d4, expected) + } + + func test_uniquingKeysWith_initializer_ambiguity() { + // https://github.com/apple/swift-collections/issues/125 + let d1 = OrderedDictionary( + ["a", "b", "a"].map { ($0, 1) }, + uniquingKeysWith: +) + expectEqualElements(d1, ["a": 2, "b": 1] as KeyValuePairs) + + let d2 = OrderedDictionary( + ["a", "b", "a"].map { (key: $0, value: 1) }, + uniquingKeysWith: +) + expectEqualElements(d2, ["a": 2, "b": 1] as KeyValuePairs) + } + + func test_merge_ambiguity() { + // https://github.com/apple/swift-collections/issues/125 + + var d1: OrderedDictionary = ["a": 1, "b": 2] + d1.merge( + ["c", "a"].map { ($0, 1) }, + uniquingKeysWith: + + ) + expectEqualElements(d1, ["a": 2, "b": 2, "c": 1] as KeyValuePairs) + + var d2: OrderedDictionary = ["a": 1, "b": 2] + d2.merge( + ["c", "a"].map { (key: $0, value: 1) }, + uniquingKeysWith: + + ) + expectEqualElements(d2, ["a": 2, "b": 2, "c": 1] as KeyValuePairs) + } + + func test_merging_ambiguity() { + // https://github.com/apple/swift-collections/issues/125 + + let d1: OrderedDictionary = ["a": 1, "b": 2] + let d1m = d1.merging( + ["c", "a"].map { ($0, 1) }, + uniquingKeysWith: + + ) + expectEqualElements(d1m, ["a": 2, "b": 2, "c": 1] as KeyValuePairs) + + let d2: OrderedDictionary = ["a": 1, "b": 2] + let d2m = d2.merging( + ["c", "a"].map { (key: $0, value: 1) }, + uniquingKeysWith: + + ) + expectEqualElements(d2m, ["a": 2, "b": 2, "c": 1] as KeyValuePairs) + } } From f504716c27d2e5d4144fa4794b12129301d17729 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Thu, 1 Sep 2022 17:29:22 -0700 Subject: [PATCH 15/15] Update README for 1.0.3 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b01bc793..0353cd5c 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ We'd like this package to quickly embrace Swift language and toolchain improveme To use this package in a SwiftPM project, you need to set it up as a package dependency: ```swift -// swift-tools-version:5.4 +// swift-tools-version:5.6 import PackageDescription let package = Package( @@ -68,7 +68,7 @@ let package = Package( dependencies: [ .package( url: "https://github.com/apple/swift-collections.git", - .upToNextMajor(from: "1.0.0") // or `.upToNextMinor + .upToNextMajor(from: "1.0.3") // or `.upToNextMinor ) ], targets: [