diff --git a/GRDB/Core/Cursor.swift b/GRDB/Core/Cursor.swift index 1917fd483..fe89ed16a 100644 --- a/GRDB/Core/Cursor.swift +++ b/GRDB/Core/Cursor.swift @@ -690,14 +690,18 @@ public final class AnyCursor: Cursor { /// Creates a cursor that wraps a base iterator but whose type depends only /// on the base iterator’s element type - public convenience init(iterator: some IteratorProtocol) { + public convenience init(iterator: I) + where I: IteratorProtocol, I.Element == Element + { var iterator = iterator self.init { iterator.next() } } /// Creates a cursor that wraps a base sequence but whose type depends only /// on the base sequence’s element type - public convenience init(_ s: some Sequence) { + public convenience init(_ s: S) + where S: Sequence, S.Element == Element + { self.init(iterator: s.makeIterator()) } diff --git a/GRDB/Core/Database+Schema.swift b/GRDB/Core/Database+Schema.swift index c69f28ad7..8bdd3c6fa 100644 --- a/GRDB/Core/Database+Schema.swift +++ b/GRDB/Core/Database+Schema.swift @@ -485,10 +485,11 @@ extension Database { /// try db.table("t", hasUniqueKey: ["c"]) // false /// try db.table("t", hasUniqueKey: ["id", "a"]) // true /// try db.table("t", hasUniqueKey: ["id", "a", "b", "c"]) // true - public func table( + public func table( _ tableName: String, - hasUniqueKey columns: some Sequence) + hasUniqueKey columns: Columns) throws -> Bool + where Columns: Sequence, Columns.Element == String { try columnsForUniqueKey(Array(columns), in: tableName) != nil } @@ -725,10 +726,11 @@ extension Database { /// returns the columns of the unique key, ordered as the matching index (or /// primary key). The case of returned columns is not guaranteed to match /// the case of input columns. - func columnsForUniqueKey( - _ columns: some Sequence, + func columnsForUniqueKey( + _ columns: Columns, in tableName: String) throws -> [String]? + where Columns: Sequence, Columns.Element == String { let lowercasedColumns = Set(columns.map { $0.lowercased() }) if lowercasedColumns.isEmpty { diff --git a/GRDB/Core/DatabaseValue.swift b/GRDB/Core/DatabaseValue.swift index 43359407d..f3d9d8c5f 100644 --- a/GRDB/Core/DatabaseValue.swift +++ b/GRDB/Core/DatabaseValue.swift @@ -1,4 +1,5 @@ -import Foundation +// TODO: remove @preconcurrency when Data conformance to Sendable is exposed. +@preconcurrency import Foundation // MARK: - DatabaseValue diff --git a/GRDB/Core/DatabaseWriter.swift b/GRDB/Core/DatabaseWriter.swift index 83ebc6e00..8084a8b36 100644 --- a/GRDB/Core/DatabaseWriter.swift +++ b/GRDB/Core/DatabaseWriter.swift @@ -625,7 +625,7 @@ extension DatabasePublishers { public typealias Output = Output public typealias Failure = Error - fileprivate let upstream: any Publisher + fileprivate let upstream: AnyPublisher public func receive(subscriber: S) where S: Subscriber, Self.Failure == S.Failure, Self.Output == S.Input { upstream.receive(subscriber: subscriber) @@ -636,7 +636,7 @@ extension DatabasePublishers { @available(OSX 10.15, iOS 13, tvOS 13, watchOS 6, *) extension Publisher where Failure == Error { fileprivate func eraseToWritePublisher() -> DatabasePublishers.Write { - .init(upstream: self) + .init(upstream: self.eraseToAnyPublisher()) } } #endif diff --git a/GRDB/Core/Row.swift b/GRDB/Core/Row.swift index b0a04cd46..e3a78dabd 100644 --- a/GRDB/Core/Row.swift +++ b/GRDB/Core/Row.swift @@ -2029,7 +2029,9 @@ extension RowImpl { struct ArrayRowImpl: RowImpl { let columns: [(String, DatabaseValue)] - init(columns: some Collection<(String, DatabaseValue)>) { + init(columns: Columns) + where Columns: Collection, Columns.Element == (String, DatabaseValue) + { self.columns = Array(columns) } diff --git a/GRDB/Core/RowAdapter.swift b/GRDB/Core/RowAdapter.swift index 978e44ede..18f24625b 100644 --- a/GRDB/Core/RowAdapter.swift +++ b/GRDB/Core/RowAdapter.swift @@ -73,7 +73,9 @@ public struct _LayoutedColumnMapping { /// /// // [foo:"foo" bar: "bar"] /// try Row.fetchOne(db, sql: "SELECT NULL, 'foo', 'bar'", adapter: FooBarAdapter()) - init(layoutColumns: some Sequence<(Int, String)>) { + init(layoutColumns: S) + where S: Sequence, S.Element == (Int, String) + { self._layoutColumns = Array(layoutColumns) self.lowercaseColumnIndexes = Dictionary( layoutColumns diff --git a/GRDB/Core/SQL.swift b/GRDB/Core/SQL.swift index cae3770d3..c43991798 100644 --- a/GRDB/Core/SQL.swift +++ b/GRDB/Core/SQL.swift @@ -248,7 +248,7 @@ extension SQL: SQLOrderingTerm { } } -extension Sequence { +extension Sequence where Element == SQL { /// Returns the concatenated `SQL` literal of this sequence of literals, /// inserting the given raw SQL separator between each element. /// @@ -272,7 +272,7 @@ extension Sequence { } } -extension Collection { +extension Collection where Element == SQL { /// Returns the concatenated `SQL` literal of this collection of literals, /// inserting the given raw SQL separator between each element. /// diff --git a/GRDB/Core/Statement.swift b/GRDB/Core/Statement.swift index e43085934..c36e66b3b 100644 --- a/GRDB/Core/Statement.swift +++ b/GRDB/Core/Statement.swift @@ -651,7 +651,9 @@ public struct StatementArguments: CustomStringConvertible, Hashable, /// /// - parameter sequence: A sequence of DatabaseValueConvertible values. /// - returns: A StatementArguments. - public init(_ sequence: some Sequence<(any DatabaseValueConvertible)?>) { + public init(_ sequence: S) + where S: Sequence, S.Element == (any DatabaseValueConvertible)? + { values = sequence.map { $0?.databaseValue ?? .null } namedValues = .init() } @@ -663,7 +665,9 @@ public struct StatementArguments: CustomStringConvertible, Hashable, /// /// - parameter sequence: A sequence of DatabaseValueConvertible values. /// - returns: A StatementArguments. - public init(_ sequence: some Sequence) { + public init(_ sequence: S) + where S: Sequence, S.Element: DatabaseValueConvertible + { values = sequence.map(\.databaseValue) namedValues = .init() } @@ -712,7 +716,9 @@ public struct StatementArguments: CustomStringConvertible, Hashable, /// /// - parameter sequence: A sequence of (key, value) pairs /// - returns: A StatementArguments. - public init(_ sequence: some Sequence<(String, (any DatabaseValueConvertible)?)>) { + public init(_ sequence: S) + where S: Sequence, S.Element == (String, (any DatabaseValueConvertible)?) + { namedValues = .init(minimumCapacity: sequence.underestimatedCount) for (key, value) in sequence { namedValues[key] = value?.databaseValue ?? .null diff --git a/GRDB/Migration/DatabaseMigrator.swift b/GRDB/Migration/DatabaseMigrator.swift index c2f1472e5..ba873a719 100644 --- a/GRDB/Migration/DatabaseMigrator.swift +++ b/GRDB/Migration/DatabaseMigrator.swift @@ -482,6 +482,7 @@ extension DatabaseMigrator { } } .receiveValues(on: scheduler) + .eraseToAnyPublisher() ) } } @@ -496,7 +497,7 @@ extension DatabasePublishers { public typealias Output = Void public typealias Failure = Error - fileprivate let upstream: any Publisher + fileprivate let upstream: AnyPublisher public func receive(subscriber: S) where S: Subscriber, Self.Failure == S.Failure, Self.Output == S.Input { upstream.receive(subscriber: subscriber) diff --git a/GRDB/QueryInterface/Request/RequestProtocols.swift b/GRDB/QueryInterface/Request/RequestProtocols.swift index a68950da2..d983b46f6 100644 --- a/GRDB/QueryInterface/Request/RequestProtocols.swift +++ b/GRDB/QueryInterface/Request/RequestProtocols.swift @@ -277,7 +277,9 @@ extension TableRequest where Self: FilteredRequest, Self: TypedRequest { /// let request = try Player...filter(rawKeys: [1, 2, 3]) /// /// - parameter keys: A collection of primary keys - func filter(rawKeys: some Sequence) -> Self { + func filter(rawKeys: Keys) -> Self + where Keys: Sequence, Keys.Element: DatabaseValueConvertible + { // Don't bother removing NULLs. We'd lose CPU cycles, and this does not // change the SQLite results anyway. let expressions = rawKeys.map { @@ -390,7 +392,9 @@ where Self: FilteredRequest, /// let request = try Player...filter(ids: [1, 2, 3]) /// /// - parameter ids: A collection of primary keys - public func filter(ids: some Collection) -> Self { + public func filter(ids: IDS) -> Self + where IDS: Collection, IDS.Element == RowDecoder.ID + { filter(keys: ids) } } diff --git a/GRDB/QueryInterface/SQL/SQLExpression.swift b/GRDB/QueryInterface/SQL/SQLExpression.swift index 04fe96e7c..bc9de466e 100644 --- a/GRDB/QueryInterface/SQL/SQLExpression.swift +++ b/GRDB/QueryInterface/SQL/SQLExpression.swift @@ -1734,7 +1734,7 @@ extension Sequence where Element: SQLSpecificExpressible { } } -extension Sequence { +extension Sequence where Element == any SQLSpecificExpressible { /// Returns an expression by joining all elements with an associative SQL /// binary operator. /// diff --git a/GRDB/QueryInterface/SQL/SQLOperators.swift b/GRDB/QueryInterface/SQL/SQLOperators.swift index af367909c..e7baeafa2 100644 --- a/GRDB/QueryInterface/SQL/SQLOperators.swift +++ b/GRDB/QueryInterface/SQL/SQLOperators.swift @@ -337,7 +337,7 @@ extension Sequence where Element: SQLExpressible { } } -extension Sequence { +extension Sequence where Element == any SQLExpressible { /// An SQL expression that checks the inclusion of an expression in /// a sequence. /// diff --git a/GRDB/QueryInterface/SQL/Table.swift b/GRDB/QueryInterface/SQL/Table.swift index b4b0b5518..4fee7d2ab 100644 --- a/GRDB/QueryInterface/SQL/Table.swift +++ b/GRDB/QueryInterface/SQL/Table.swift @@ -230,8 +230,9 @@ extension Table { /// // SELECT * FROM player WHERE id IN (1, 2, 3) /// let table = Table("player") /// let request = table.filter(keys: [1, 2, 3]) - public func filter(keys: some Sequence) + public func filter(keys: Keys) -> QueryInterfaceRequest + where Keys: Sequence, Keys.Element: DatabaseValueConvertible { all().filter(keys: keys) } @@ -390,7 +391,9 @@ extension Table where RowDecoder: Identifiable, RowDecoder.ID: DatabaseValueConv /// let request = table.filter(ids: [1, 2, 3]) /// /// - parameter ids: A collection of primary keys - public func filter(ids: some Collection) -> QueryInterfaceRequest { + public func filter(ids: IDS) -> QueryInterfaceRequest + where IDS: Collection, IDS.Element == RowDecoder.ID + { all().filter(ids: ids) } } @@ -1240,8 +1243,9 @@ extension Table { /// - keys: A sequence of primary keys. /// - returns: The number of deleted rows @discardableResult - public func deleteAll(_ db: Database, keys: some Sequence) + public func deleteAll(_ db: Database, keys: Keys) throws -> Int + where Keys: Sequence, Keys.Element: DatabaseValueConvertible { let keys = Array(keys) if keys.isEmpty { @@ -1305,7 +1309,9 @@ where RowDecoder: Identifiable, /// - ids: A collection of primary keys. /// - returns: The number of deleted rows @discardableResult - public func deleteAll(_ db: Database, ids: some Collection) throws -> Int { + public func deleteAll(_ db: Database, ids: IDS) throws -> Int + where IDS: Collection, IDS.Element == RowDecoder.ID + { if ids.isEmpty { // Avoid hitting the database return 0 diff --git a/GRDB/QueryInterface/SQLInterpolation+QueryInterface.swift b/GRDB/QueryInterface/SQLInterpolation+QueryInterface.swift index a68dda642..6273975a8 100644 --- a/GRDB/QueryInterface/SQLInterpolation+QueryInterface.swift +++ b/GRDB/QueryInterface/SQLInterpolation+QueryInterface.swift @@ -209,7 +209,9 @@ extension SQLInterpolation { /// let request: SQLRequest = """ /// SELECT * FROM player WHERE id IN \(ids) /// """ - public mutating func appendInterpolation(_ sequence: some Sequence) { + public mutating func appendInterpolation(_ sequence: S) + where S: Sequence, S.Element: SQLExpressible + { let e: [SQL.Element] = sequence.map { .expression($0.sqlExpression) } if e.isEmpty { appendLiteral("(SELECT NULL WHERE NULL)") @@ -235,14 +237,18 @@ extension SQLInterpolation { /// let request: SQLRequest = """ /// SELECT * FROM player WHERE a IN \(expressions) /// """ - public mutating func appendInterpolation(_ sequence: some Sequence){ + public mutating func appendInterpolation(_ sequence: S) + where S: Sequence, S.Element == any SQLExpressible + { appendInterpolation(sequence.lazy.map(\.sqlExpression)) } // When a value is both an expression and a sequence of expressions, // favor the expression side. Use case: Foundation.Data interpolation. /// :nodoc: - public mutating func appendInterpolation(_ expressible: some SQLExpressible & Sequence) { + public mutating func appendInterpolation(_ expressible: S) + where S: SQLExpressible, S: Sequence, S.Element: SQLExpressible + { elements.append(.expression(expressible.sqlExpression)) } diff --git a/GRDB/QueryInterface/TableRecord+QueryInterfaceRequest.swift b/GRDB/QueryInterface/TableRecord+QueryInterfaceRequest.swift index 35b5c1d55..be9e3ad51 100644 --- a/GRDB/QueryInterface/TableRecord+QueryInterfaceRequest.swift +++ b/GRDB/QueryInterface/TableRecord+QueryInterfaceRequest.swift @@ -191,8 +191,9 @@ extension TableRecord { /// /// // SELECT * FROM player WHERE id IN (1, 2, 3) /// let request = Player.filter(keys: [1, 2, 3]) - public static func filter(keys: some Sequence) + public static func filter(keys: Keys) -> QueryInterfaceRequest + where Keys: Sequence, Keys.Element: DatabaseValueConvertible { all().filter(keys: keys) } @@ -379,7 +380,9 @@ extension TableRecord where Self: Identifiable, ID: DatabaseValueConvertible { /// let request = Player.filter(ids: [1, 2, 3]) /// /// - parameter ids: A collection of primary keys - public static func filter(ids: some Collection) -> QueryInterfaceRequest { + public static func filter(ids: IDS) -> QueryInterfaceRequest + where IDS: Collection, IDS.Element == ID + { all().filter(ids: ids) } } diff --git a/GRDB/Record/FetchableRecord+TableRecord.swift b/GRDB/Record/FetchableRecord+TableRecord.swift index 2799a2592..43e4b59b8 100644 --- a/GRDB/Record/FetchableRecord+TableRecord.swift +++ b/GRDB/Record/FetchableRecord+TableRecord.swift @@ -94,8 +94,9 @@ extension FetchableRecord where Self: TableRecord { /// - keys: A sequence of primary keys. /// - returns: A cursor over fetched records. /// - throws: A DatabaseError is thrown whenever an SQLite error occurs. - public static func fetchCursor(_ db: Database, keys: some Sequence) + public static func fetchCursor(_ db: Database, keys: Keys) throws -> RecordCursor + where Keys: Sequence, Keys.Element: DatabaseValueConvertible { try filter(keys: keys).fetchCursor(db) } @@ -111,8 +112,9 @@ extension FetchableRecord where Self: TableRecord { /// - keys: A sequence of primary keys. /// - returns: An array of records. /// - throws: A DatabaseError is thrown whenever an SQLite error occurs. - public static func fetchAll(_ db: Database, keys: some Sequence) + public static func fetchAll(_ db: Database, keys: Keys) throws -> [Self] + where Keys: Sequence, Keys.Element: DatabaseValueConvertible { let keys = Array(keys) if keys.isEmpty { @@ -159,8 +161,9 @@ extension FetchableRecord where Self: TableRecord & Identifiable, ID: DatabaseVa /// - ids: A collection of primary keys. /// - returns: A cursor over fetched records. /// - throws: A DatabaseError is thrown whenever an SQLite error occurs. - public static func fetchCursor(_ db: Database, ids: some Collection) + public static func fetchCursor(_ db: Database, ids: IDS) throws -> RecordCursor + where IDS: Collection, IDS.Element == ID { try filter(ids: ids).fetchCursor(db) } @@ -176,7 +179,9 @@ extension FetchableRecord where Self: TableRecord & Identifiable, ID: DatabaseVa /// - ids: A collection of primary keys. /// - returns: An array of records. /// - throws: A DatabaseError is thrown whenever an SQLite error occurs. - public static func fetchAll(_ db: Database, ids: some Collection) throws -> [Self] { + public static func fetchAll(_ db: Database, ids: IDS) throws -> [Self] + where IDS: Collection, IDS.Element == ID + { if ids.isEmpty { // Avoid hitting the database return [] @@ -208,8 +213,9 @@ extension FetchableRecord where Self: TableRecord & Hashable { /// - keys: A sequence of primary keys. /// - returns: A set of records. /// - throws: A DatabaseError is thrown whenever an SQLite error occurs. - public static func fetchSet(_ db: Database, keys: some Sequence) + public static func fetchSet(_ db: Database, keys: Keys) throws -> Set + where Keys: Sequence, Keys.Element: DatabaseValueConvertible { let keys = Array(keys) if keys.isEmpty { @@ -231,7 +237,9 @@ extension FetchableRecord where Self: TableRecord & Hashable & Identifiable, ID: /// - ids: A collection of primary keys. /// - returns: A set of records. /// - throws: A DatabaseError is thrown whenever an SQLite error occurs. - public static func fetchSet(_ db: Database, ids: some Collection) throws -> Set { + public static func fetchSet(_ db: Database, ids: IDS) throws -> Set + where IDS: Collection, IDS.Element == ID + { if ids.isEmpty { // Avoid hitting the database return [] diff --git a/GRDB/Record/MutablePersistableRecord+Update.swift b/GRDB/Record/MutablePersistableRecord+Update.swift index 3a14af097..cce51cfcb 100644 --- a/GRDB/Record/MutablePersistableRecord+Update.swift +++ b/GRDB/Record/MutablePersistableRecord+Update.swift @@ -28,11 +28,12 @@ extension MutablePersistableRecord { /// PersistenceError.recordNotFound is thrown if the primary key does not /// match any row in the database. @inlinable // allow specialization so that empty callbacks are removed - public func update( + public func update( _ db: Database, onConflict conflictResolution: Database.ConflictResolution? = nil, - columns: some Sequence) + columns: Columns) throws + where Columns: Sequence, Columns.Element == String { try willSave(db) @@ -57,11 +58,12 @@ extension MutablePersistableRecord { /// PersistenceError.recordNotFound is thrown if the primary key does not /// match any row in the database. @inlinable // allow specialization so that empty callbacks are removed - public func update( + public func update( _ db: Database, onConflict conflictResolution: Database.ConflictResolution? = nil, - columns: some Sequence) + columns: Columns) throws + where Columns: Sequence, Columns.Element: ColumnExpression { try update(db, onConflict: conflictResolution, columns: columns.map(\.name)) } @@ -283,13 +285,14 @@ extension MutablePersistableRecord { /// match any row in the database. /// - precondition: `selection` is not empty. @inlinable // allow specialization so that empty callbacks are removed - public func updateAndFetch( + public func updateAndFetch( _ db: Database, onConflict conflictResolution: Database.ConflictResolution? = nil, - columns: some Sequence, + columns: Columns, selection: [any SQLSelectable], fetch: (Statement) throws -> T) throws -> T + where Columns: Sequence, Columns.Element == String { GRDBPrecondition(!selection.isEmpty, "Invalid empty selection") @@ -338,13 +341,14 @@ extension MutablePersistableRecord { /// match any row in the database. /// - precondition: `selection` is not empty. @inlinable // allow specialization so that empty callbacks are removed - public func updateAndFetch( + public func updateAndFetch( _ db: Database, onConflict conflictResolution: Database.ConflictResolution? = nil, - columns: some Sequence, + columns: Columns, selection: [any SQLSelectable], fetch: (Statement) throws -> T) throws -> T + where Columns: Sequence, Columns.Element: ColumnExpression { try updateAndFetch( db, onConflict: conflictResolution, @@ -558,13 +562,14 @@ extension MutablePersistableRecord { /// - precondition: `selection` is not empty. @inlinable // allow specialization so that empty callbacks are removed @available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) // SQLite 3.35.0+ - public func updateAndFetch( + public func updateAndFetch( _ db: Database, onConflict conflictResolution: Database.ConflictResolution? = nil, - columns: some Sequence, + columns: Columns, selection: [any SQLSelectable], fetch: (Statement) throws -> T) throws -> T + where Columns: Sequence, Columns.Element == String { GRDBPrecondition(!selection.isEmpty, "Invalid empty selection") @@ -614,13 +619,14 @@ extension MutablePersistableRecord { /// - precondition: `selection` is not empty. @inlinable // allow specialization so that empty callbacks are removed @available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) // SQLite 3.35.0+ - public func updateAndFetch( + public func updateAndFetch( _ db: Database, onConflict conflictResolution: Database.ConflictResolution? = nil, - columns: some Sequence, + columns: Columns, selection: [any SQLSelectable], fetch: (Statement) throws -> T) throws -> T + where Columns: Sequence, Columns.Element: ColumnExpression { try updateAndFetch( db, onConflict: conflictResolution, diff --git a/GRDB/Record/TableRecord.swift b/GRDB/Record/TableRecord.swift index 0ab4f951f..b6d42354c 100644 --- a/GRDB/Record/TableRecord.swift +++ b/GRDB/Record/TableRecord.swift @@ -243,8 +243,9 @@ extension TableRecord { /// - keys: A sequence of primary keys. /// - returns: The number of deleted records @discardableResult - public static func deleteAll(_ db: Database, keys: some Sequence) + public static func deleteAll(_ db: Database, keys: Keys) throws -> Int + where Keys: Sequence, Keys.Element: DatabaseValueConvertible { let keys = Array(keys) if keys.isEmpty { @@ -305,7 +306,9 @@ extension TableRecord where Self: Identifiable, ID: DatabaseValueConvertible { /// - ids: A collection of primary keys. /// - returns: The number of deleted records @discardableResult - public static func deleteAll(_ db: Database, ids: some Collection) throws -> Int { + public static func deleteAll(_ db: Database, ids: IDS) throws -> Int + where IDS: Collection, IDS.Element == ID + { if ids.isEmpty { // Avoid hitting the database return 0 diff --git a/GRDB/Utils/OrderedDictionary.swift b/GRDB/Utils/OrderedDictionary.swift index c4e1f0ccb..3bd60eaf2 100644 --- a/GRDB/Utils/OrderedDictionary.swift +++ b/GRDB/Utils/OrderedDictionary.swift @@ -114,10 +114,11 @@ struct OrderedDictionary { return OrderedDictionary(keys: keys, dictionary: dictionary) } - mutating func merge( - _ other: some Sequence<(Key, Value)>, + mutating func merge( + _ other: S, uniquingKeysWith combine: (Value, Value) throws -> Value) rethrows + where S: Sequence, S.Element == (Key, Value) { for (key, value) in other { if let current = self[key] { @@ -128,10 +129,11 @@ struct OrderedDictionary { } } - mutating func merge( - _ other: some Sequence<(key: Key, value: Value)>, + mutating func merge( + _ other: S, uniquingKeysWith combine: (Value, Value) throws -> Value) rethrows + where S: Sequence, S.Element == (key: Key, value: Value) { for (key, value) in other { if let current = self[key] { @@ -142,20 +144,22 @@ struct OrderedDictionary { } } - func merging( - _ other: some Sequence<(Key, Value)>, + func merging( + _ other: S, uniquingKeysWith combine: (Value, Value) throws -> Value) rethrows -> OrderedDictionary + where S: Sequence, S.Element == (Key, Value) { var result = self try result.merge(other, uniquingKeysWith: combine) return result } - func merging( - _ other: some Sequence<(key: Key, value: Value)>, + func merging( + _ other: S, uniquingKeysWith combine: (Value, Value) throws -> Value) rethrows -> OrderedDictionary + where S: Sequence, S.Element == (key: Key, value: Value) { var result = self try result.merge(other, uniquingKeysWith: combine) diff --git a/Tests/GRDBTests/SQLRequestTests.swift b/Tests/GRDBTests/SQLRequestTests.swift index 104cadc28..2c95c8012 100644 --- a/Tests/GRDBTests/SQLRequestTests.swift +++ b/Tests/GRDBTests/SQLRequestTests.swift @@ -125,7 +125,9 @@ class SQLRequestTests: GRDBTestCase { """ } - static func filter(excludedIds: some Sequence) -> SQLRequest { + static func filter(excludedIds: IDS) -> SQLRequest + where IDS: Sequence, IDS.Element == Int64 + { """ SELECT * FROM \(self)