Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Swift 4.1 warnings #797

Merged
merged 5 commits into from
Apr 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: objective-c
rvm: 2.3
osx_image: xcode9
osx_image: xcode9.3
env:
global:
- IOS_SIMULATOR="iPhone 6s"
- IOS_VERSION="11.0"
- IOS_VERSION="11.3"
matrix:
include:
- env: BUILD_SCHEME="SQLite iOS"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BUILD_TOOL = xcodebuild
BUILD_SCHEME = SQLite Mac
IOS_SIMULATOR = iPhone 6s
IOS_VERSION = 11.0
IOS_VERSION = 11.3
ifeq ($(BUILD_SCHEME),SQLite iOS)
BUILD_ARGUMENTS = -scheme "$(BUILD_SCHEME)" -destination "platform=iOS Simulator,name=$(IOS_SIMULATOR),OS=$(IOS_VERSION)"
else
Expand Down
10 changes: 7 additions & 3 deletions SQLite.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 0930;
TargetAttributes = {
03A65E591C6BB0F50062603F = {
CreatedOnToolsVersion = 7.2;
Expand Down Expand Up @@ -1063,7 +1063,7 @@
03A65E6D1C6BB0F60062603F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = Tests/SQLite/Info.plist;
INFOPLIST_FILE = Tests/SQLiteTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1077,7 +1077,7 @@
03A65E6E1C6BB0F60062603F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = Tests/SQLite/Info.plist;
INFOPLIST_FILE = Tests/SQLiteTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1148,12 +1148,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -1206,12 +1208,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down
4 changes: 1 addition & 3 deletions SQLite.xcodeproj/xcshareddata/xcschemes/SQLite Mac.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 1 addition & 3 deletions SQLite.xcodeproj/xcshareddata/xcschemes/SQLite iOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 1 addition & 3 deletions SQLite.xcodeproj/xcshareddata/xcschemes/SQLite tvOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Sources/SQLite/Typed/Coding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ fileprivate class SQLiteDecoder : Decoder {
}

var allKeys: [Key] {
return self.row.columnNames.keys.flatMap({Key(stringValue: $0)})
return self.row.columnNames.keys.compactMap({Key(stringValue: $0)})
}

func contains(_ key: Key) -> Bool {
Expand Down
2 changes: 1 addition & 1 deletion Sources/SQLite/Typed/CoreFunctions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ extension ExpressionType where UnderlyingType == String? {

}

extension Collection where Iterator.Element : Value, IndexDistance == Int {
extension Collection where Iterator.Element : Value {

/// Builds a copy of the expression prepended with an `IN` check against the
/// collection.
Expand Down
8 changes: 4 additions & 4 deletions Sources/SQLite/Typed/Query.swift
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ extension QueryType {
whereClause
]

return Insert(" ".join(clauses.flatMap { $0 }).expression)
return Insert(" ".join(clauses.compactMap { $0 }).expression)
}

/// Runs an `INSERT` statement against the query with `DEFAULT VALUES`.
Expand Down Expand Up @@ -690,7 +690,7 @@ extension QueryType {
limitOffsetClause
]

return Update(" ".join(clauses.flatMap { $0 }).expression)
return Update(" ".join(clauses.compactMap { $0 }).expression)
}

// MARK: DELETE
Expand All @@ -704,7 +704,7 @@ extension QueryType {
limitOffsetClause
]

return Delete(" ".join(clauses.flatMap { $0 }).expression)
return Delete(" ".join(clauses.compactMap { $0 }).expression)
}

// MARK: EXISTS
Expand Down Expand Up @@ -789,7 +789,7 @@ extension QueryType {
limitOffsetClause
]

return " ".join(clauses.flatMap { $0 }).expression
return " ".join(clauses.compactMap { $0 }).expression
}

}
Expand Down
18 changes: 9 additions & 9 deletions Sources/SQLite/Typed/Schema.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extension Table {
withoutRowid ? Expression<Void>(literal: "WITHOUT ROWID") : nil
]

return " ".join(clauses.flatMap { $0 }).asSQL()
return " ".join(clauses.compactMap { $0 }).asSQL()
}

public func create(_ query: QueryType, temporary: Bool = false, ifNotExists: Bool = false) -> String {
Expand All @@ -57,7 +57,7 @@ extension Table {
query
]

return " ".join(clauses.flatMap { $0 }).asSQL()
return " ".join(clauses.compactMap { $0 }).asSQL()
}

// MARK: - ALTER TABLE … ADD COLUMN
Expand Down Expand Up @@ -135,7 +135,7 @@ extension Table {
"".wrap(columns) as Expression<Void>
]

return " ".join(clauses.flatMap { $0 }).asSQL()
return " ".join(clauses.compactMap { $0 }).asSQL()
}

// MARK: - DROP INDEX
Expand Down Expand Up @@ -174,7 +174,7 @@ extension View {
query
]

return " ".join(clauses.flatMap { $0 }).asSQL()
return " ".join(clauses.compactMap { $0 }).asSQL()
}

// MARK: - DROP VIEW
Expand All @@ -196,7 +196,7 @@ extension VirtualTable {
using
]

return " ".join(clauses.flatMap { $0 }).asSQL()
return " ".join(clauses.compactMap { $0 }).asSQL()
}

// MARK: - ALTER TABLE … RENAME TO
Expand Down Expand Up @@ -405,7 +405,7 @@ public final class TableBuilder {
delete.map { Expression<Void>(literal: "ON DELETE \($0.rawValue)") }
]

definitions.append(" ".join(clauses.flatMap { $0 }))
definitions.append(" ".join(clauses.compactMap { $0 }))
}

}
Expand Down Expand Up @@ -456,7 +456,7 @@ private extension QueryType {
name
]

return " ".join(clauses.flatMap { $0 })
return " ".join(clauses.compactMap { $0 })
}

func rename(to: Self) -> String {
Expand All @@ -475,7 +475,7 @@ private extension QueryType {
name
]

return " ".join(clauses.flatMap { $0 }).asSQL()
return " ".join(clauses.compactMap { $0 }).asSQL()
}

}
Expand All @@ -493,7 +493,7 @@ private func definition(_ column: Expressible, _ datatype: String, _ primaryKey:
collate.map { " ".join([Expression<Void>(literal: "COLLATE"), $0]) }
]

return " ".join(clauses.flatMap { $0 })
return " ".join(clauses.compactMap { $0 })
}

private func reference(_ primary: (QueryType, Expressible)) -> Expressible {
Expand Down
2 changes: 1 addition & 1 deletion Tests/CocoaPods/Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'

gem 'cocoapods', '~> 1.3.1'
gem 'cocoapods', '~> 1.5.0'
gem 'minitest'
Loading