Better checks for Swift < 4.1 (thanks @hartbit!)

This commit is contained in:
Gwendal Roué committed 2018-03-12 18:33:06 +01:00
1 parent 9505ba1606
commit 1cbe60a13f
8 files changed
+10 -20

No files matched your search

+2 -4
View File
@@ -841,8 +841,7 @@ extension Database {
self.rawValue = rawValue
}
#if swift(>=4.1)
#else
#if !swift(>=4.1)
/// The hash value
/// :nodoc:
public var hashValue: Int {
@@ -881,8 +880,7 @@ extension Database {
self.rawValue = rawValue
}
#if swift(>=4.1)
#else
#if !swift(>=4.1)
/// The hash value
/// :nodoc:
public var hashValue: Int {
+1 -2
View File
@@ -139,8 +139,7 @@ public struct ResultCode : RawRepresentable, Equatable, CustomStringConvertible
public static let SQLITE_OK_LOAD_PERMANENTLY = ResultCode(rawValue: (SQLITE_OK.rawValue | (1<<8)))
}
#if swift(>=4.1)
#else
#if !swift(>=4.1)
// Equatable
extension ResultCode {
/// :nodoc:
+1 -2
View File
@@ -11,8 +11,7 @@ public final class DatabaseFunction: Hashable {
let name: String
let nArg: Int32 // -1 for variadic functions
#if swift(>=4.1)
#else
#if !swift(>=4.1)
var hashValue: Int {
return name.hashValue ^ nArg.hashValue
}
+1 -2
View File
@@ -255,8 +255,7 @@ private struct TableRegion: Equatable {
return false
}
#if swift(>=4.1)
#else
#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 }
+1 -2
View File
@@ -911,8 +911,7 @@ extension StatementArguments {
}
}
#if swift(>=4.1)
#else
#if !swift(>=4.1)
// Equatable
extension StatementArguments {
/// :nodoc:
+1 -2
View File
@@ -1,7 +1,6 @@
// Compatibility layer for Swift < 4.1
#if swift(>=4.1)
#else
#if !swift(>=4.1)
extension Sequence {
// From future import SE-0187
func compactMap<ElementOfResult>(_ transform: (Self.Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult] {
@@ -486,8 +486,7 @@ public struct SQLFunctionName : Hashable {
self.sql = sql
}
#if swift(>=4.1)
#else
#if !swift(>=4.1)
/// The hash value
///
/// :nodoc:
+2 -4
View File
@@ -985,8 +985,7 @@ private struct InsertQuery: Hashable {
// Not generated by Swift 4.1
var hashValue: Int { return tableName.hashValue }
#if swift(>=4.1)
#else
#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 }
@@ -1027,8 +1026,7 @@ private struct UpdateQuery: Hashable {
// Not generated by Swift 4.1
var hashValue: Int { return tableName.hashValue }
#if swift(>=4.1)
#else
#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 }