Skip to content

Commit 52889d8

Browse files
authored
Merge pull request #797 from stephencelis/swift-4.1
Fix Swift 4.1 warnings
2 parents c052d41 + a1d478e commit 52889d8

17 files changed

+92
-60
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
language: objective-c
22
rvm: 2.3
3-
osx_image: xcode9
3+
osx_image: xcode9.3
44
env:
55
global:
66
- IOS_SIMULATOR="iPhone 6s"
7-
- IOS_VERSION="11.0"
7+
- IOS_VERSION="11.3"
88
matrix:
99
include:
1010
- env: BUILD_SCHEME="SQLite iOS"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
BUILD_TOOL = xcodebuild
22
BUILD_SCHEME = SQLite Mac
33
IOS_SIMULATOR = iPhone 6s
4-
IOS_VERSION = 11.0
4+
IOS_VERSION = 11.3
55
ifeq ($(BUILD_SCHEME),SQLite iOS)
66
BUILD_ARGUMENTS = -scheme "$(BUILD_SCHEME)" -destination "platform=iOS Simulator,name=$(IOS_SIMULATOR),OS=$(IOS_VERSION)"
77
else

SQLite.xcodeproj/project.pbxproj

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@
680680
isa = PBXProject;
681681
attributes = {
682682
LastSwiftUpdateCheck = 0720;
683-
LastUpgradeCheck = 0900;
683+
LastUpgradeCheck = 0930;
684684
TargetAttributes = {
685685
03A65E591C6BB0F50062603F = {
686686
CreatedOnToolsVersion = 7.2;
@@ -1063,7 +1063,7 @@
10631063
03A65E6D1C6BB0F60062603F /* Debug */ = {
10641064
isa = XCBuildConfiguration;
10651065
buildSettings = {
1066-
INFOPLIST_FILE = Tests/SQLite/Info.plist;
1066+
INFOPLIST_FILE = Tests/SQLiteTests/Info.plist;
10671067
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
10681068
PRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;
10691069
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1077,7 +1077,7 @@
10771077
03A65E6E1C6BB0F60062603F /* Release */ = {
10781078
isa = XCBuildConfiguration;
10791079
buildSettings = {
1080-
INFOPLIST_FILE = Tests/SQLite/Info.plist;
1080+
INFOPLIST_FILE = Tests/SQLiteTests/Info.plist;
10811081
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
10821082
PRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLiteTests;
10831083
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1148,12 +1148,14 @@
11481148
CLANG_WARN_BOOL_CONVERSION = YES;
11491149
CLANG_WARN_COMMA = YES;
11501150
CLANG_WARN_CONSTANT_CONVERSION = YES;
1151+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
11511152
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
11521153
CLANG_WARN_EMPTY_BODY = YES;
11531154
CLANG_WARN_ENUM_CONVERSION = YES;
11541155
CLANG_WARN_INFINITE_RECURSION = YES;
11551156
CLANG_WARN_INT_CONVERSION = YES;
11561157
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
1158+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
11571159
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
11581160
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
11591161
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -1206,12 +1208,14 @@
12061208
CLANG_WARN_BOOL_CONVERSION = YES;
12071209
CLANG_WARN_COMMA = YES;
12081210
CLANG_WARN_CONSTANT_CONVERSION = YES;
1211+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
12091212
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
12101213
CLANG_WARN_EMPTY_BODY = YES;
12111214
CLANG_WARN_ENUM_CONVERSION = YES;
12121215
CLANG_WARN_INFINITE_RECURSION = YES;
12131216
CLANG_WARN_INT_CONVERSION = YES;
12141217
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
1218+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
12151219
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
12161220
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
12171221
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;

SQLite.xcodeproj/xcshareddata/xcschemes/SQLite Mac.xcscheme

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0900"
3+
LastUpgradeVersion = "0930"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,7 +26,6 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
language = ""
3029
shouldUseLaunchSchemeArgsEnv = "YES">
3130
<Testables>
3231
<TestableReference
@@ -56,7 +55,6 @@
5655
buildConfiguration = "Debug"
5756
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5857
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
59-
language = ""
6058
launchStyle = "0"
6159
useCustomWorkingDirectory = "NO"
6260
ignoresPersistentStateOnLaunch = "NO"

SQLite.xcodeproj/xcshareddata/xcschemes/SQLite iOS.xcscheme

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0900"
3+
LastUpgradeVersion = "0930"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,7 +26,6 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
language = ""
3029
shouldUseLaunchSchemeArgsEnv = "YES">
3130
<Testables>
3231
<TestableReference
@@ -56,7 +55,6 @@
5655
buildConfiguration = "Debug"
5756
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5857
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
59-
language = ""
6058
launchStyle = "0"
6159
useCustomWorkingDirectory = "NO"
6260
ignoresPersistentStateOnLaunch = "NO"

SQLite.xcodeproj/xcshareddata/xcschemes/SQLite tvOS.xcscheme

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0900"
3+
LastUpgradeVersion = "0930"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,7 +26,6 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
language = ""
3029
shouldUseLaunchSchemeArgsEnv = "YES">
3130
<Testables>
3231
<TestableReference
@@ -56,7 +55,6 @@
5655
buildConfiguration = "Debug"
5756
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5857
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
59-
language = ""
6058
launchStyle = "0"
6159
useCustomWorkingDirectory = "NO"
6260
ignoresPersistentStateOnLaunch = "NO"

SQLite.xcodeproj/xcshareddata/xcschemes/SQLite watchOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0900"
3+
LastUpgradeVersion = "0930"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Sources/SQLite/Typed/Coding.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ fileprivate class SQLiteDecoder : Decoder {
217217
}
218218

219219
var allKeys: [Key] {
220-
return self.row.columnNames.keys.flatMap({Key(stringValue: $0)})
220+
return self.row.columnNames.keys.compactMap({Key(stringValue: $0)})
221221
}
222222

223223
func contains(_ key: Key) -> Bool {

Sources/SQLite/Typed/CoreFunctions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ extension ExpressionType where UnderlyingType == String? {
637637

638638
}
639639

640-
extension Collection where Iterator.Element : Value, IndexDistance == Int {
640+
extension Collection where Iterator.Element : Value {
641641

642642
/// Builds a copy of the expression prepended with an `IN` check against the
643643
/// collection.

Sources/SQLite/Typed/Query.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ extension QueryType {
647647
whereClause
648648
]
649649

650-
return Insert(" ".join(clauses.flatMap { $0 }).expression)
650+
return Insert(" ".join(clauses.compactMap { $0 }).expression)
651651
}
652652

653653
/// Runs an `INSERT` statement against the query with `DEFAULT VALUES`.
@@ -690,7 +690,7 @@ extension QueryType {
690690
limitOffsetClause
691691
]
692692

693-
return Update(" ".join(clauses.flatMap { $0 }).expression)
693+
return Update(" ".join(clauses.compactMap { $0 }).expression)
694694
}
695695

696696
// MARK: DELETE
@@ -704,7 +704,7 @@ extension QueryType {
704704
limitOffsetClause
705705
]
706706

707-
return Delete(" ".join(clauses.flatMap { $0 }).expression)
707+
return Delete(" ".join(clauses.compactMap { $0 }).expression)
708708
}
709709

710710
// MARK: EXISTS
@@ -789,7 +789,7 @@ extension QueryType {
789789
limitOffsetClause
790790
]
791791

792-
return " ".join(clauses.flatMap { $0 }).expression
792+
return " ".join(clauses.compactMap { $0 }).expression
793793
}
794794

795795
}

Sources/SQLite/Typed/Schema.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ extension Table {
4747
withoutRowid ? Expression<Void>(literal: "WITHOUT ROWID") : nil
4848
]
4949

50-
return " ".join(clauses.flatMap { $0 }).asSQL()
50+
return " ".join(clauses.compactMap { $0 }).asSQL()
5151
}
5252

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

60-
return " ".join(clauses.flatMap { $0 }).asSQL()
60+
return " ".join(clauses.compactMap { $0 }).asSQL()
6161
}
6262

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

138-
return " ".join(clauses.flatMap { $0 }).asSQL()
138+
return " ".join(clauses.compactMap { $0 }).asSQL()
139139
}
140140

141141
// MARK: - DROP INDEX
@@ -174,7 +174,7 @@ extension View {
174174
query
175175
]
176176

177-
return " ".join(clauses.flatMap { $0 }).asSQL()
177+
return " ".join(clauses.compactMap { $0 }).asSQL()
178178
}
179179

180180
// MARK: - DROP VIEW
@@ -196,7 +196,7 @@ extension VirtualTable {
196196
using
197197
]
198198

199-
return " ".join(clauses.flatMap { $0 }).asSQL()
199+
return " ".join(clauses.compactMap { $0 }).asSQL()
200200
}
201201

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

408-
definitions.append(" ".join(clauses.flatMap { $0 }))
408+
definitions.append(" ".join(clauses.compactMap { $0 }))
409409
}
410410

411411
}
@@ -456,7 +456,7 @@ private extension QueryType {
456456
name
457457
]
458458

459-
return " ".join(clauses.flatMap { $0 })
459+
return " ".join(clauses.compactMap { $0 })
460460
}
461461

462462
func rename(to: Self) -> String {
@@ -475,7 +475,7 @@ private extension QueryType {
475475
name
476476
]
477477

478-
return " ".join(clauses.flatMap { $0 }).asSQL()
478+
return " ".join(clauses.compactMap { $0 }).asSQL()
479479
}
480480

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

496-
return " ".join(clauses.flatMap { $0 })
496+
return " ".join(clauses.compactMap { $0 })
497497
}
498498

499499
private func reference(_ primary: (QueryType, Expressible)) -> Expressible {

Tests/CocoaPods/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
source 'https://rubygems.org'
22

3-
gem 'cocoapods', '~> 1.3.1'
3+
gem 'cocoapods', '~> 1.5.0'
44
gem 'minitest'

0 commit comments

Comments
 (0)