Skip to content

Commit d1d0791

Browse files
committed
Fix a few Swift 4.1 warnings.
1 parent 1f79681 commit d1d0791

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

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 {

0 commit comments

Comments
 (0)