Skip to content

Commit c3904cd

Browse files
committed
Fixup CI and take care of the new warnings that appear in Swift 6.2.
1 parent b50120e commit c3904cd

File tree

9 files changed

+43
-22
lines changed

9 files changed

+43
-22
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Ensure curl is available
2222
run: apt-get update -y && apt-get install -y curl
2323
- name: Check out code
24-
uses: actions/checkout@v4
24+
uses: actions/checkout@v5
2525
- name: Run unit tests
2626
env:
2727
TRAITS_FLAG: ${{ matrix.swift == 'swift:6.1-noble' && '--enable-all-traits' || '' }}
@@ -47,7 +47,7 @@ jobs:
4747
with:
4848
xcode-version: ${{ matrix.xcode-version }}
4949
- name: Check out code
50-
uses: actions/checkout@v4
50+
uses: actions/checkout@v5
5151
- name: Run unit tests
5252
run: |
5353
swift test --enable-code-coverage -Xswiftc -warnings-as-errors --enable-all-traits

Sources/FluentKitExtras/OptionalPointerProperty.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ extension Model {
66
public typealias OptionalPointer<To, ToProp> = OptionalPointerProperty<Self, To, ToProp>
77
where
88
To: FluentKit.Model,
9-
ToProp: QueryableProperty, ToProp.Model == To, ToProp.Value: Hashable
9+
ToProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype,
10+
ToProp.Model == To, ToProp.Value: Hashable
1011
}
1112

1213
// MARK: Type
@@ -30,7 +31,7 @@ extension Model {
3031
public final class OptionalPointerProperty<From, To, ToProp>: @unchecked Sendable
3132
where
3233
From: FluentKit.Model, To: FluentKit.Model,
33-
ToProp: QueryableProperty, ToProp.Model == To, ToProp.Value: Hashable
34+
ToProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype, ToProp.Model == To, ToProp.Value: Hashable
3435
{
3536
@OptionalFieldProperty<From, ToProp.Value>
3637
public var ref: ToProp.Value?
@@ -185,7 +186,7 @@ extension OptionalPointerProperty: EagerLoadable {
185186
private struct OptionalPointerEagerLoader<From, To, ToProp>: EagerLoader
186187
where
187188
From: FluentKit.Model, To: FluentKit.Model,
188-
ToProp: FluentKit.QueryableProperty, ToProp.Model == To, ToProp.Value: Hashable
189+
ToProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype, ToProp.Model == To, ToProp.Value: Hashable
189190
{
190191
// Needed because the extension that normally adds this inside FluentKit is not public.
191192
func anyRun(models: [any AnyModel], on database: any Database) -> EventLoopFuture<Void> {
@@ -236,7 +237,7 @@ private struct ThroughOptionalPointerEagerLoader<From, Through, ThroughProp, Loa
236237
where
237238
From: FluentKit.Model,
238239
Loader: EagerLoader, Loader.Model == Through,
239-
ThroughProp: QueryableProperty, ThroughProp.Model == Through, ThroughProp.Value: Hashable
240+
ThroughProp: QueryableProperty & _SQLKitExtrasSendableMetatype, ThroughProp.Model == Through, ThroughProp.Value: Hashable
240241
{
241242
// Needed because the extension that normally adds this inside FluentKit is not public.
242243
func anyRun(models: [any AnyModel], on database: any Database) -> EventLoopFuture<Void> {

Sources/FluentKitExtras/OptionalReferenceProperty.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extension Model {
55
public typealias OptionalReference<To, FromProp> = OptionalReferenceProperty<Self, To, FromProp>
66
where
77
To: FluentKit.Model,
8-
FromProp: QueryableProperty, FromProp.Model == Self, FromProp.Value: Hashable
8+
FromProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype, FromProp.Model == Self, FromProp.Value: Hashable
99
}
1010

1111
// MARK: Type
@@ -22,7 +22,7 @@ extension Model {
2222
@propertyWrapper
2323
public final class OptionalReferenceProperty<From, To, FromProp>: @unchecked Sendable
2424
where From: FluentKit.Model, To: FluentKit.Model,
25-
FromProp: QueryableProperty, FromProp.Model == From, FromProp.Value: Hashable
25+
FromProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype, FromProp.Model == From, FromProp.Value: Hashable
2626
{
2727
public let parentKey: RelationPointerKey<From, To, FromProp>
2828
let fromKeypath: KeyPath<From, FromProp>
@@ -229,7 +229,8 @@ extension OptionalReferenceProperty: EagerLoadable {
229229
private struct OptionalReferenceEagerLoader<From, To, FromProp>: EagerLoader
230230
where
231231
From: FluentKit.Model, To: FluentKit.Model,
232-
FromProp: QueryableProperty, FromProp.Model == From, FromProp.Value: Hashable
232+
FromProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype,
233+
FromProp.Model == From, FromProp.Value: Hashable
233234
{
234235
// Needed because the extension that normally adds this inside FluentKit is not public.
235236
func anyRun(models: [any AnyModel], on database: any Database) -> EventLoopFuture<Void> {
@@ -270,7 +271,8 @@ private struct OptionalReferenceEagerLoader<From, To, FromProp>: EagerLoader
270271
private struct ThroughReferenceEagerLoader<From, Through, FromProp, Loader>: EagerLoader
271272
where
272273
From: FluentKit.Model,
273-
Loader: EagerLoader, Loader.Model == Through, FromProp: QueryableProperty, FromProp.Model == From, FromProp.Value: Hashable
274+
Loader: EagerLoader, Loader.Model == Through, FromProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype,
275+
FromProp.Model == From, FromProp.Value: Hashable
274276
{
275277
// Needed because the extension that normally adds this inside FluentKit is not public.
276278
func anyRun(models: [any AnyModel], on database: any Database) -> EventLoopFuture<Void> {

Sources/FluentKitExtras/PointerProperty.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ extension Model {
66
public typealias Pointer<To, ToProp> = PointerProperty<Self, To, ToProp>
77
where
88
To: FluentKit.Model,
9-
ToProp: QueryableProperty, ToProp.Model == To, ToProp.Value: Hashable
9+
ToProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype,
10+
ToProp.Model == To, ToProp.Value: Hashable
1011
}
1112

1213
// MARK: Type
@@ -29,7 +30,7 @@ extension Model {
2930
@propertyWrapper
3031
public final class PointerProperty<From, To, ToProp>: @unchecked Sendable
3132
where From: FluentKit.Model, To: FluentKit.Model,
32-
ToProp: QueryableProperty, ToProp.Model == To, ToProp.Value: Hashable
33+
ToProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype, ToProp.Model == To, ToProp.Value: Hashable
3334
{
3435
@FieldProperty<From, ToProp.Value>
3536
public var ref: ToProp.Value
@@ -184,7 +185,7 @@ extension PointerProperty: EagerLoadable {
184185
private struct PointerEagerLoader<From, To, ToProp>: EagerLoader
185186
where
186187
From: FluentKit.Model, To: FluentKit.Model,
187-
ToProp: FluentKit.QueryableProperty, ToProp.Model == To, ToProp.Value: Hashable
188+
ToProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype, ToProp.Model == To, ToProp.Value: Hashable
188189
{
189190
// Needed because the extension that normally adds this inside FluentKit is not public.
190191
func anyRun(models: [any AnyModel], on database: any Database) -> EventLoopFuture<Void> {
@@ -222,7 +223,7 @@ private struct ThroughPointerEagerLoader<From, Through, ThroughProp, Loader>: Ea
222223
where
223224
From: FluentKit.Model,
224225
Loader: EagerLoader, Loader.Model == Through,
225-
ThroughProp: QueryableProperty, ThroughProp.Model == Through, ThroughProp.Value: Hashable
226+
ThroughProp: QueryableProperty & _SQLKitExtrasSendableMetatype, ThroughProp.Model == Through, ThroughProp.Value: Hashable
226227
{
227228
// Needed because the extension that normally adds this inside FluentKit is not public.
228229
func anyRun(models: [any AnyModel], on database: any Database) -> EventLoopFuture<Void> {

Sources/FluentKitExtras/ReferencesProperty.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ extension Model {
55
public typealias References<To, FromProp> = ReferencesProperty<Self, To, FromProp>
66
where
77
To: FluentKit.Model,
8-
FromProp: QueryableProperty, FromProp.Model == Self, FromProp.Value: Hashable
8+
FromProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype,
9+
FromProp.Model == Self, FromProp.Value: Hashable
910
}
1011

1112
// MARK: Type
@@ -23,7 +24,7 @@ extension Model {
2324
public final class ReferencesProperty<From, To, FromProp>: @unchecked Sendable
2425
where
2526
From: FluentKit.Model, To: FluentKit.Model,
26-
FromProp: QueryableProperty, FromProp.Model == From, FromProp.Value: Hashable
27+
FromProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype, FromProp.Model == From, FromProp.Value: Hashable
2728
{
2829
public let parentKey: RelationPointerKey<From, To, FromProp>
2930
let fromKeypath: KeyPath<From, FromProp>
@@ -243,7 +244,7 @@ extension ReferencesProperty: EagerLoadable {
243244
private struct ReferencesEagerLoader<From, To, FromProp>: EagerLoader
244245
where
245246
From: FluentKit.Model, To: FluentKit.Model,
246-
FromProp: QueryableProperty, FromProp.Model == From, FromProp.Value: Hashable
247+
FromProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype, FromProp.Model == From, FromProp.Value: Hashable
247248
{
248249
// Needed because the extension that normally adds this inside FluentKit is not public.
249250
func anyRun(models: [any AnyModel], on database: any Database) -> EventLoopFuture<Void> {
@@ -282,7 +283,8 @@ private struct ReferencesEagerLoader<From, To, FromProp>: EagerLoader
282283
private struct ThroughReferencesEagerLoader<From, Through, FromProp, Loader>: EagerLoader
283284
where
284285
From: FluentKit.Model,
285-
Loader: EagerLoader, Loader.Model == Through, FromProp: QueryableProperty, FromProp.Model == From, FromProp.Value: Hashable
286+
Loader: EagerLoader, Loader.Model == Through, FromProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype,
287+
FromProp.Model == From, FromProp.Value: Hashable
286288
{
287289
// Needed because the extension that normally adds this inside FluentKit is not public.
288290
func anyRun(models: [any AnyModel], on database: any Database) -> EventLoopFuture<Void> {

Sources/FluentKitExtras/RelationPointerKey.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import FluentKit
33
public enum RelationPointerKey<From, To, FromProp>: Sendable
44
where
55
From: FluentKit.Model, To: FluentKit.Model,
6-
FromProp: QueryableProperty, FromProp.Model == From, FromProp.Value: Hashable
6+
FromProp: FluentKit.QueryableProperty & _SQLKitExtrasSendableMetatype,
7+
FromProp.Model == From, FromProp.Value: Hashable
78
{
89
case required(KeyPath<To, To.Pointer<From, FromProp>>)
910
case optional(KeyPath<To, To.OptionalPointer<From, FromProp>>)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import FluentKit
2+
3+
#if compiler(>=6.2)
4+
5+
@_marker public protocol _SQLKitExtrasSendableMetatype: SendableMetatype {}
6+
7+
extension FluentKit.FieldProperty: _SQLKitExtrasSendableMetatype {}
8+
9+
#else
10+
11+
@_marker public protocol _SQLKitExtrasSendableMetatype {}
12+
13+
#endif
14+

Sources/SQLKitExtras/FluentSQLKitExtras/Builders/SQLJoinBuilder+FluentKeypaths.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extension SQLJoinBuilder {
4646
method: SQLJoinMethod = .inner,
4747
on expression: some SQLExpression
4848
) -> Self {
49-
if let alias = alias.map(String.init(_:)) ?? type.alias {
49+
if let alias = alias.map({ String($0) }) ?? type.alias {
5050
self.join(.table(type.schema, space: type.space), as: alias, method: method, on: expression)
5151
} else {
5252
self.join(.table(type.schema, space: type.space), method: method, on: expression)
@@ -76,7 +76,7 @@ extension SQLJoinBuilder {
7676
method: SQLJoinMethod = .inner,
7777
using columns: some Sequence<any SQLExpression>
7878
) -> Self {
79-
if let alias = alias.map(String.init(_:)) ?? type.alias {
79+
if let alias = alias.map({ String($0) }) ?? type.alias {
8080
self.join(.table(type.schema, space: type.space), as: alias, method: method, using: columns)
8181
} else {
8282
self.join(.table(type.schema, space: type.space), method: method, using: .list(columns))

Sources/SQLKitExtras/SQLKitExtras/BuiltinExpressions/SQLColumn.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extension SQLExpression {
66
_ name: some StringProtocol,
77
table: (some StringProtocol)? = String?.none
88
) -> Self where Self == SQLColumn {
9-
.init(String(name), table: table.map(String.init(_:)))
9+
.init(String(name), table: table.map { String($0) })
1010
}
1111

1212
/// A convenience method for creating an `SQLColumn` from a column name and table expression.

0 commit comments

Comments
 (0)