From 5747d1cff0f8d2fdeeb7c9b68e9b424a0c212f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Mon, 30 Apr 2018 08:26:23 +0200 Subject: [PATCH] No more #if swift(>=4.1) --- GRDB.xcodeproj/project.pbxproj | 8 ------- GRDB/Core/Cursor.swift | 8 ------- GRDB/Core/Database.swift | 16 ------------- GRDB/Core/DatabaseError.swift | 10 -------- GRDB/Core/DatabaseFunction.swift | 10 -------- GRDB/Core/DatabaseRegion.swift | 8 ------- GRDB/Core/Statement.swift | 12 ---------- GRDB/Legacy/Swift4.1.swift | 24 ------------------- .../SQLExpression+QueryInterface.swift | 18 +------------- GRDB/Record/PersistableRecord.swift | 21 ++-------------- GRDBCipher.xcodeproj/project.pbxproj | 6 ----- GRDBCustom.xcodeproj/project.pbxproj | 6 ----- Tests/GRDBTests/CursorTests.swift | 9 ------- Tests/GRDBTests/DatabaseAggregateTests.swift | 4 ---- Tests/GRDBTests/DatabaseFunctionTests.swift | 4 ---- .../QueryInterfaceExpressionsTests.swift | 4 ---- 16 files changed, 3 insertions(+), 165 deletions(-) delete mode 100644 GRDB/Legacy/Swift4.1.swift diff --git a/GRDB.xcodeproj/project.pbxproj b/GRDB.xcodeproj/project.pbxproj index 229b2acee..5a20e3e81 100755 --- a/GRDB.xcodeproj/project.pbxproj +++ b/GRDB.xcodeproj/project.pbxproj @@ -481,9 +481,6 @@ 56B021CD1D8C0D3900B239BB /* MutablePersistableRecordPersistenceConflictPolicyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B021C81D8C0D3900B239BB /* MutablePersistableRecordPersistenceConflictPolicyTests.swift */; }; 56B14E831D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B14E7E1D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift */; }; 56B15D0B1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B15D0A1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift */; }; - 56B1C3CD201C8D0E001938DA /* Swift4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B1C3CC201C8D0E001938DA /* Swift4.1.swift */; }; - 56B1C3CE201C8D0E001938DA /* Swift4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B1C3CC201C8D0E001938DA /* Swift4.1.swift */; }; - 56B1C3CF201C8D0E001938DA /* Swift4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B1C3CC201C8D0E001938DA /* Swift4.1.swift */; }; 56B6EF56208CB4E3002F0ACB /* ColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF55208CB4E3002F0ACB /* ColumnExpressionTests.swift */; }; 56B6EF57208CB4E3002F0ACB /* ColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF55208CB4E3002F0ACB /* ColumnExpressionTests.swift */; }; 56B7F42A1BE14A1900E39BBF /* CGFloatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7F4291BE14A1900E39BBF /* CGFloatTests.swift */; }; @@ -1030,7 +1027,6 @@ 56B021C81D8C0D3900B239BB /* MutablePersistableRecordPersistenceConflictPolicyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableRecordPersistenceConflictPolicyTests.swift; sourceTree = ""; }; 56B14E7E1D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFromDictionaryLiteralTests.swift; sourceTree = ""; }; 56B15D0A1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchedRecordsControllerTests.swift; sourceTree = ""; }; - 56B1C3CC201C8D0E001938DA /* Swift4.1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Swift4.1.swift; sourceTree = ""; }; 56B6EF55208CB4E3002F0ACB /* ColumnExpressionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColumnExpressionTests.swift; sourceTree = ""; }; 56B7F4291BE14A1900E39BBF /* CGFloatTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGFloatTests.swift; sourceTree = ""; }; 56B7F4391BEB42D500E39BBF /* Migration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Migration.swift; sourceTree = ""; }; @@ -1748,7 +1744,6 @@ 56D121591ED34978001347D2 /* Fixits-0.109.0.swift */, 56873BEB1F2CB400004D24B4 /* Fixits-1.2.swift */, 569A98EC2039B6F3008D7DBF /* Fixits-3.0.swift */, - 56B1C3CC201C8D0E001938DA /* Swift4.1.swift */, ); path = Legacy; sourceTree = ""; @@ -2399,7 +2394,6 @@ 5653EB1720944C7C00F46237 /* AssociationQuery.swift in Sources */, 565490B81D5AE236005622CB /* DatabaseError.swift in Sources */, 56BF6D3C1DEF47DA006039A3 /* Fixits-0-90-1.swift in Sources */, - 56B1C3CF201C8D0E001938DA /* Swift4.1.swift in Sources */, 56DAA2E11DE9C827006E10C8 /* Cursor.swift in Sources */, 5653EB0520944C7C00F46237 /* BelongsToAssociation.swift in Sources */, 565490BC1D5AE236005622CB /* DatabaseSchemaCache.swift in Sources */, @@ -2487,7 +2481,6 @@ 5674A7081F307FCD0095F066 /* DatabaseValueConvertible+ReferenceConvertible.swift in Sources */, 56A2388C1B9C75030082EB20 /* Statement.swift in Sources */, 5659F4931EA8D964004A4992 /* ReadWriteBox.swift in Sources */, - 56B1C3CE201C8D0E001938DA /* Swift4.1.swift in Sources */, 5605F1941C6B1A8700235C62 /* QueryInterfaceQuery.swift in Sources */, 56B7F43B1BEB42D500E39BBF /* Migration.swift in Sources */, 5690C3431D23E82A00E59934 /* Data.swift in Sources */, @@ -2928,7 +2921,6 @@ 5605F1931C6B1A8700235C62 /* QueryInterfaceQuery.swift in Sources */, 566B912B1FA4D0CC0012D5B0 /* StatementAuthorizer.swift in Sources */, 56A2388B1B9C75030082EB20 /* Statement.swift in Sources */, - 56B1C3CD201C8D0E001938DA /* Swift4.1.swift in Sources */, 5690C3401D23E82A00E59934 /* Data.swift in Sources */, 5659F4881EA8D94E004A4992 /* Utils.swift in Sources */, 56FC98781D969DEF00E3C842 /* SQLExpression+QueryInterface.swift in Sources */, diff --git a/GRDB/Core/Cursor.swift b/GRDB/Core/Cursor.swift index 8de34aebe..0062157d4 100644 --- a/GRDB/Core/Cursor.swift +++ b/GRDB/Core/Cursor.swift @@ -132,7 +132,6 @@ extension Cursor { return nil } - #if swift(>=4.1) /// Returns a cursor over the concatenated non-nil results of mapping /// transform over this cursor. public func compactMap(_ transform: @escaping (Element) throws -> ElementOfResult?) -> MapCursor>, ElementOfResult> { @@ -143,13 +142,6 @@ extension Cursor { public func flatMap(_ transform: @escaping (Element) throws -> ElementOfResult?) -> MapCursor>, ElementOfResult> { return compactMap(transform) } - #else - /// Returns a cursor over the concatenated non-nil results of mapping - /// transform over this cursor. - public func flatMap(_ transform: @escaping (Element) throws -> ElementOfResult?) -> MapCursor>, ElementOfResult> { - return map(transform).filter { $0 != nil }.map { $0! } - } - #endif /// Returns a cursor that skips any initial elements that satisfy /// `predicate`. diff --git a/GRDB/Core/Database.swift b/GRDB/Core/Database.swift index 9d38e5cd9..c93f4841b 100644 --- a/GRDB/Core/Database.swift +++ b/GRDB/Core/Database.swift @@ -867,14 +867,6 @@ extension Database { self.rawValue = rawValue } - #if !swift(>=4.1) - /// The hash value - /// :nodoc: - public var hashValue: Int { - return rawValue.hashValue - } - #endif - /// The `BINARY` built-in SQL collation public static let binary = CollationName("BINARY") @@ -906,14 +898,6 @@ extension Database { self.rawValue = rawValue } - #if !swift(>=4.1) - /// The hash value - /// :nodoc: - public var hashValue: Int { - return rawValue.hashValue - } - #endif - /// The `TEXT` SQL column type public static let text = ColumnType("TEXT") diff --git a/GRDB/Core/DatabaseError.swift b/GRDB/Core/DatabaseError.swift index afa6cb5d9..778e3e8ef 100644 --- a/GRDB/Core/DatabaseError.swift +++ b/GRDB/Core/DatabaseError.swift @@ -139,16 +139,6 @@ public struct ResultCode : RawRepresentable, Equatable, CustomStringConvertible public static let SQLITE_OK_LOAD_PERMANENTLY = ResultCode(rawValue: (SQLITE_OK.rawValue | (1<<8))) } -#if !swift(>=4.1) -// Equatable -extension ResultCode { - /// :nodoc: - public static func == (_ lhs: ResultCode, _ rhs: ResultCode) -> Bool { - return lhs.rawValue == rhs.rawValue - } -} -#endif - // CustomStringConvertible extension ResultCode { /// :nodoc: diff --git a/GRDB/Core/DatabaseFunction.swift b/GRDB/Core/DatabaseFunction.swift index 257740ff1..5e64eb366 100644 --- a/GRDB/Core/DatabaseFunction.swift +++ b/GRDB/Core/DatabaseFunction.swift @@ -10,16 +10,6 @@ public final class DatabaseFunction: Hashable { private struct Identity: Hashable { let name: String let nArg: Int32 // -1 for variadic functions - - #if !swift(>=4.1) - var hashValue: Int { - return name.hashValue ^ nArg.hashValue - } - - static func == (lhs: Identity, rhs: Identity) -> Bool { - return lhs.name == rhs.name && lhs.nArg == rhs.nArg - } - #endif } public var name: String { return identity.name } diff --git a/GRDB/Core/DatabaseRegion.swift b/GRDB/Core/DatabaseRegion.swift index 678144fbf..99a2d092a 100644 --- a/GRDB/Core/DatabaseRegion.swift +++ b/GRDB/Core/DatabaseRegion.swift @@ -255,14 +255,6 @@ private struct TableRegion: Equatable { return false } - #if !swift(>=4.1) - static func == (lhs: TableRegion, rhs: TableRegion) -> Bool { - if lhs.columns != rhs.columns { return false } - if lhs.rowIds != rhs.rowIds { return false } - return true - } - #endif - func intersection(_ other: TableRegion) -> TableRegion { let columnsIntersection: Set? switch (self.columns, other.columns) { diff --git a/GRDB/Core/Statement.swift b/GRDB/Core/Statement.swift index 482def1cd..0bc43bc6c 100644 --- a/GRDB/Core/Statement.swift +++ b/GRDB/Core/Statement.swift @@ -905,18 +905,6 @@ extension StatementArguments { } } -#if !swift(>=4.1) -// Equatable -extension StatementArguments { - /// :nodoc: - public static func == (lhs: StatementArguments, rhs: StatementArguments) -> Bool { - if lhs.values != rhs.values { return false } - if lhs.namedValues != rhs.namedValues { return false } - return true - } -} -#endif - /// A thread-unsafe statement cache struct StatementCache { unowned let db: Database diff --git a/GRDB/Legacy/Swift4.1.swift b/GRDB/Legacy/Swift4.1.swift deleted file mode 100644 index c1adaac2f..000000000 --- a/GRDB/Legacy/Swift4.1.swift +++ /dev/null @@ -1,24 +0,0 @@ -// Compatibility layer for Swift < 4.1 - -#if !swift(>=4.1) -extension Sequence { - // From future import SE-0187 - func compactMap(_ transform: (Self.Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult] { - return try flatMap(transform) - } -} - -extension UnsafeMutablePointer { - // From future import SE-0184 - func deallocate() { - deallocate(capacity: 0) - } -} - -extension UnsafeMutableRawBufferPointer { - // From future import SE-0184 - func copyMemory(from source: C) where C : Collection, C.Element == UInt8 { - copyBytes(from: source) - } -} -#endif diff --git a/GRDB/QueryInterface/SQLExpression+QueryInterface.swift b/GRDB/QueryInterface/SQLExpression+QueryInterface.swift index 3248c9963..734e88d87 100644 --- a/GRDB/QueryInterface/SQLExpression+QueryInterface.swift +++ b/GRDB/QueryInterface/SQLExpression+QueryInterface.swift @@ -556,7 +556,7 @@ public struct SQLFunctionName : Hashable { /// The SQL function name /// /// :nodoc: - public let sql: String + public var sql: String /// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features) /// @@ -568,22 +568,6 @@ public struct SQLFunctionName : Hashable { public init(_ sql: String) { self.sql = sql } - - #if !swift(>=4.1) - /// The hash value - /// - /// :nodoc: - public var hashValue: Int { - return sql.hashValue - } - - /// Equality operator - /// - /// :nodoc: - public static func == (lhs: SQLFunctionName, rhs: SQLFunctionName) -> Bool { - return lhs.sql == rhs.sql - } - #endif } /// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features) diff --git a/GRDB/Record/PersistableRecord.swift b/GRDB/Record/PersistableRecord.swift index 96a3f82b1..e5d9cfd5b 100644 --- a/GRDB/Record/PersistableRecord.swift +++ b/GRDB/Record/PersistableRecord.swift @@ -991,16 +991,8 @@ private struct InsertQuery: Hashable { let tableName: String let insertedColumns: [String] - // Not generated by Swift 4.1 + // TODO: remove when Swift can generate it var hashValue: Int { return tableName.hashValue } - - #if !swift(>=4.1) - static func == (lhs: InsertQuery, rhs: InsertQuery) -> Bool { - if lhs.tableName != rhs.tableName { return false } - if lhs.onConflict != rhs.onConflict { return false } - return lhs.insertedColumns == rhs.insertedColumns - } - #endif } extension InsertQuery { @@ -1032,17 +1024,8 @@ private struct UpdateQuery: Hashable { let updatedColumns: [String] let conditionColumns: [String] - // Not generated by Swift 4.1 + // TODO: remove when Swift can generate it var hashValue: Int { return tableName.hashValue } - - #if !swift(>=4.1) - static func == (lhs: UpdateQuery, rhs: UpdateQuery) -> Bool { - if lhs.tableName != rhs.tableName { return false } - if lhs.onConflict != rhs.onConflict { return false } - if lhs.updatedColumns != rhs.updatedColumns { return false } - return lhs.conditionColumns == rhs.conditionColumns - } - #endif } extension UpdateQuery { diff --git a/GRDBCipher.xcodeproj/project.pbxproj b/GRDBCipher.xcodeproj/project.pbxproj index 8b911d1ec..09684ca77 100755 --- a/GRDBCipher.xcodeproj/project.pbxproj +++ b/GRDBCipher.xcodeproj/project.pbxproj @@ -554,8 +554,6 @@ 5698AD391DABAF4A0056AF8C /* FTS5CustomTokenizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5698AD341DABAF4A0056AF8C /* FTS5CustomTokenizer.swift */; }; 569A98FC2039B72D008D7DBF /* Fixits-3.0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569A98FA2039B72C008D7DBF /* Fixits-3.0.swift */; }; 569A98FD2039B72D008D7DBF /* Fixits-3.0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569A98FA2039B72C008D7DBF /* Fixits-3.0.swift */; }; - 569B7FA8201C904C0069DE70 /* Swift4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569B7FA6201C904C0069DE70 /* Swift4.1.swift */; }; - 569B7FA9201C904C0069DE70 /* Swift4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569B7FA6201C904C0069DE70 /* Swift4.1.swift */; }; 569C1EB31CF07DDD0042627B /* SchedulingWatchdogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569C1EB11CF07DDD0042627B /* SchedulingWatchdogTests.swift */; }; 569C1EB41CF07DDD0042627B /* SchedulingWatchdogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569C1EB11CF07DDD0042627B /* SchedulingWatchdogTests.swift */; }; 569C1EB61CF07DDD0042627B /* SchedulingWatchdogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569C1EB11CF07DDD0042627B /* SchedulingWatchdogTests.swift */; }; @@ -1076,7 +1074,6 @@ 5698AD201DABAEFA0056AF8C /* FTS5WrapperTokenizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5WrapperTokenizer.swift; sourceTree = ""; }; 5698AD341DABAF4A0056AF8C /* FTS5CustomTokenizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5CustomTokenizer.swift; sourceTree = ""; }; 569A98FA2039B72C008D7DBF /* Fixits-3.0.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-3.0.swift"; sourceTree = ""; }; - 569B7FA6201C904C0069DE70 /* Swift4.1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Swift4.1.swift; sourceTree = ""; }; 569C1EB11CF07DDD0042627B /* SchedulingWatchdogTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchedulingWatchdogTests.swift; sourceTree = ""; }; 569EF0E8200D387000A9FA45 /* DatabaseRegion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseRegion.swift; sourceTree = ""; }; 56A238131B9C74A90082EB20 /* DatabaseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseTests.swift; sourceTree = ""; }; @@ -1753,7 +1750,6 @@ 56D121591ED34978001347D2 /* Fixits-0.109.0.swift */, 56873BEB1F2CB400004D24B4 /* Fixits-1.2.swift */, 569A98FA2039B72C008D7DBF /* Fixits-3.0.swift */, - 569B7FA6201C904C0069DE70 /* Swift4.1.swift */, ); path = Legacy; sourceTree = ""; @@ -2164,7 +2160,6 @@ 564F9C2F1F07611400877A00 /* DatabaseFunction.swift in Sources */, 5659F4991EA8D989004A4992 /* Pool.swift in Sources */, 5653EB8F20961FC000F46237 /* BelongsToAssociation.swift in Sources */, - 569B7FA8201C904C0069DE70 /* Swift4.1.swift in Sources */, 5674A6FA1F307F600095F066 /* PersistableRecord+Encodable.swift in Sources */, 56CEB54D1EAA359A00BFAF62 /* SQLExpressible.swift in Sources */, 5664759B1D97D8A000FF74B8 /* SQLCollection.swift in Sources */, @@ -2597,7 +2592,6 @@ 564F9C321F07611700877A00 /* DatabaseFunction.swift in Sources */, 5659F49C1EA8D989004A4992 /* Pool.swift in Sources */, 5653EB9020961FC000F46237 /* BelongsToAssociation.swift in Sources */, - 569B7FA9201C904C0069DE70 /* Swift4.1.swift in Sources */, 5674A6F71F307F600095F066 /* PersistableRecord+Encodable.swift in Sources */, 56CEB5501EAA359A00BFAF62 /* SQLExpressible.swift in Sources */, 5664759E1D97D8A000FF74B8 /* SQLCollection.swift in Sources */, diff --git a/GRDBCustom.xcodeproj/project.pbxproj b/GRDBCustom.xcodeproj/project.pbxproj index 9f2aa8291..210584469 100755 --- a/GRDBCustom.xcodeproj/project.pbxproj +++ b/GRDBCustom.xcodeproj/project.pbxproj @@ -237,8 +237,6 @@ 5698AD3A1DABAF4A0056AF8C /* FTS5CustomTokenizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5698AD341DABAF4A0056AF8C /* FTS5CustomTokenizer.swift */; }; 569A98F82039B716008D7DBF /* Fixits-3.0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569A98F62039B716008D7DBF /* Fixits-3.0.swift */; }; 569A98F92039B716008D7DBF /* Fixits-3.0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569A98F62039B716008D7DBF /* Fixits-3.0.swift */; }; - 569B7FA4201C90430069DE70 /* Swift4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569B7FA2201C90430069DE70 /* Swift4.1.swift */; }; - 569B7FA5201C90430069DE70 /* Swift4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569B7FA2201C90430069DE70 /* Swift4.1.swift */; }; 569EF0E6200D37FD00A9FA45 /* DatabaseRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569EF0E5200D37FC00A9FA45 /* DatabaseRegion.swift */; }; 569EF0E7200D37FD00A9FA45 /* DatabaseRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569EF0E5200D37FC00A9FA45 /* DatabaseRegion.swift */; }; 56A4CDB31D4234B200B1A9B9 /* SQLExpressionLiteralTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A4CDAF1D4234B200B1A9B9 /* SQLExpressionLiteralTests.swift */; }; @@ -743,7 +741,6 @@ 5698AD201DABAEFA0056AF8C /* FTS5WrapperTokenizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5WrapperTokenizer.swift; sourceTree = ""; }; 5698AD341DABAF4A0056AF8C /* FTS5CustomTokenizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5CustomTokenizer.swift; sourceTree = ""; }; 569A98F62039B716008D7DBF /* Fixits-3.0.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-3.0.swift"; sourceTree = ""; }; - 569B7FA2201C90430069DE70 /* Swift4.1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Swift4.1.swift; sourceTree = ""; }; 569C1EB11CF07DDD0042627B /* SchedulingWatchdogTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchedulingWatchdogTests.swift; sourceTree = ""; }; 569EF0E5200D37FC00A9FA45 /* DatabaseRegion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseRegion.swift; sourceTree = ""; }; 56A238131B9C74A90082EB20 /* DatabaseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseTests.swift; sourceTree = ""; }; @@ -1399,7 +1396,6 @@ 56D121591ED34978001347D2 /* Fixits-0.109.0.swift */, 56873BEB1F2CB400004D24B4 /* Fixits-1.2.swift */, 569A98F62039B716008D7DBF /* Fixits-3.0.swift */, - 569B7FA2201C90430069DE70 /* Swift4.1.swift */, ); path = Legacy; sourceTree = ""; @@ -1839,7 +1835,6 @@ 564F9C331F07611800877A00 /* DatabaseFunction.swift in Sources */, 5659F49D1EA8D989004A4992 /* Pool.swift in Sources */, 5653EB4220961F6100F46237 /* BelongsToAssociation.swift in Sources */, - 569B7FA5201C90430069DE70 /* Swift4.1.swift in Sources */, 5674A6F61F307F600095F066 /* PersistableRecord+Encodable.swift in Sources */, 56CEB5511EAA359A00BFAF62 /* SQLExpressible.swift in Sources */, 5698AC3C1D9E5A590056AF8C /* FTS3Pattern.swift in Sources */, @@ -2111,7 +2106,6 @@ 564F9C301F07611500877A00 /* DatabaseFunction.swift in Sources */, 5659F49A1EA8D989004A4992 /* Pool.swift in Sources */, 5653EB4120961F6100F46237 /* BelongsToAssociation.swift in Sources */, - 569B7FA4201C90430069DE70 /* Swift4.1.swift in Sources */, 5674A6F51F307F600095F066 /* PersistableRecord+Encodable.swift in Sources */, 56CEB54E1EAA359A00BFAF62 /* SQLExpressible.swift in Sources */, 5698AC391D9E5A590056AF8C /* FTS3Pattern.swift in Sources */, diff --git a/Tests/GRDBTests/CursorTests.swift b/Tests/GRDBTests/CursorTests.swift index f73f99419..c69411c3b 100644 --- a/Tests/GRDBTests/CursorTests.swift +++ b/Tests/GRDBTests/CursorTests.swift @@ -78,21 +78,12 @@ class CursorTests: GRDBTestCase { } } - #if swift(>=4.1) func testCompactMap() { let cursor = AnyCursor(["1", "foo", "2"]).compactMap { Int($0) } XCTAssertEqual(try cursor.next()!, 1) XCTAssertEqual(try cursor.next()!, 2) XCTAssertTrue(try cursor.next() == nil) // end } - #else - func testFlatMapOfOptional() { - let cursor = AnyCursor(["1", "foo", "2"]).flatMap { Int($0) } - XCTAssertEqual(try cursor.next()!, 1) - XCTAssertEqual(try cursor.next()!, 2) - XCTAssertTrue(try cursor.next() == nil) // end - } - #endif func testForEach() throws { let cursor = AnyCursor([1, 2]) diff --git a/Tests/GRDBTests/DatabaseAggregateTests.swift b/Tests/GRDBTests/DatabaseAggregateTests.swift index faf882210..bf466b528 100644 --- a/Tests/GRDBTests/DatabaseAggregateTests.swift +++ b/Tests/GRDBTests/DatabaseAggregateTests.swift @@ -295,11 +295,7 @@ class DatabaseAggregateTests: GRDBTestCase { struct Aggregate : DatabaseAggregate { var result: DatabaseValueConvertible? mutating func step(_ dbValues: [DatabaseValue]) { - #if swift(>=4.1) let ints = dbValues.compactMap { Int.fromDatabaseValue($0) } - #else - let ints = dbValues.flatMap { Int.fromDatabaseValue($0) } - #endif result = ints.reduce(0, +) } func finalize() -> DatabaseValueConvertible? { diff --git a/Tests/GRDBTests/DatabaseFunctionTests.swift b/Tests/GRDBTests/DatabaseFunctionTests.swift index 4fd02a4b7..60ae195bb 100644 --- a/Tests/GRDBTests/DatabaseFunctionTests.swift +++ b/Tests/GRDBTests/DatabaseFunctionTests.swift @@ -250,11 +250,7 @@ class DatabaseFunctionTests: GRDBTestCase { func testFunctionOfTwoArguments() throws { let dbQueue = try makeDatabaseQueue() let fn = DatabaseFunction("f", argumentCount: 2) { dbValues in - #if swift(>=4.1) let ints = dbValues.compactMap { Int.fromDatabaseValue($0) } - #else - let ints = dbValues.flatMap { Int.fromDatabaseValue($0) } - #endif return ints.reduce(0, +) } dbQueue.add(function: fn) diff --git a/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift b/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift index b06954417..f2c8e18e0 100644 --- a/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift +++ b/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift @@ -31,11 +31,7 @@ class QueryInterfaceExpressionsTests: GRDBTestCase { dbWriter.add(collation: collation) customFunction = DatabaseFunction("avgOf", pure: true) { dbValues in - #if swift(>=4.1) let sum = dbValues.compactMap { Int.fromDatabaseValue($0) }.reduce(0, +) - #else - let sum = dbValues.flatMap { Int.fromDatabaseValue($0) }.reduce(0, +) - #endif return Double(sum) / Double(dbValues.count) } dbWriter.add(function: self.customFunction)