Skip to content

Commit 84323a6

Browse files
author
Stijn Willems
committed
fix: Use swift-sharing fix branch for Swift 6.2.3 optimizer crash
Updates dependency to use fix/swift-623-optimizer-crash branch which includes compiler guards to work around the Swift 6.2.3 optimizer crash in SharedChangeTracker deinit.
1 parent 1449317 commit 84323a6

File tree

4 files changed

+39
-24
lines changed

4 files changed

+39
-24
lines changed

Package.resolved

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ let package = Package(
3030
.package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.0.0"),
3131
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.3.3"),
3232
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.9.0"),
33-
// NB: Fork with Swift 6.3 fixes (uses doozMen/swift-perception)
34-
.package(url: "https://github.com/doozMen/swift-sharing", branch: "main"),
33+
// NB: Fork with Swift 6.3 fixes
34+
.package(url: "https://github.com/doozMen/swift-sharing", branch: "fix/swift-623-optimizer-crash"),
3535
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.18.4"),
3636
// NB: Fork with Swift 6.3 fixes
3737
.package(
@@ -70,9 +70,10 @@ let package = Package(
7070
"SQLiteData",
7171
.product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"),
7272
.product(name: "CustomDump", package: "swift-custom-dump"),
73-
.product(name: "Perception", package: "swift-perception"),
74-
.product(name: "Sharing", package: "swift-sharing"),
75-
.product(name: "StructuredQueriesSQLite", package: "swift-structured-queries"),
73+
.product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"),
74+
.product(name: "Sharing", package: "swift-sharing"),
75+
.product(name: "StructuredQueriesSQLite", package: "swift-structured-queries"),
76+
.product(name: "StructuredQueriesTestSupport", package: "swift-structured-queries"),
7677
]
7778
),
7879
.testTarget(
@@ -82,7 +83,7 @@ let package = Package(
8283
"SQLiteDataTestSupport",
8384
.product(name: "DependenciesTestSupport", package: "swift-dependencies"),
8485
.product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"),
85-
package: "swift-tagged",
86+
.product(name: "Tagged", package: "swift-tagged"),
8687
.product(name: "SnapshotTestingCustomDump", package: "swift-snapshot-testing"),
8788
.product(name: "StructuredQueries", package: "swift-structured-queries"),
8889
]

Sources/SQLiteData/StructuredQueries+GRDB/Statement+GRDB.swift

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -186,24 +186,29 @@ extension SelectStatement where QueryValue == (), Joins == () {
186186
}
187187
}
188188

189-
extension SelectStatement where QueryValue == (), From: PrimaryKeyedTable, Joins == () {
190-
/// Returns a single value fetched from the database for a given primary key.
191-
///
192-
/// - Parameters
193-
/// - db: A database connection.
194-
/// - primaryKey: A primary key identifying a table row.
195-
/// - Returns: A single value decoded from the database.
196-
@inlinable
197-
public func find(
198-
_ db: Database,
199-
key primaryKey: some QueryExpression<From.PrimaryKey>
200-
) throws -> From.QueryOutput {
201-
guard let record = try asSelect().find(primaryKey).fetchOne(db) else {
202-
throw NotFound()
189+
// NB: Swift 6.2.3 and 6.3-dev guard Select.find(_:) in swift-structured-queries due to compiler crashes.
190+
// This extension depends on that method, so it must also be guarded.
191+
// Tracking: https://github.com/swiftlang/swift/issues/82529
192+
#if !compiler(>=6.2.3)
193+
extension SelectStatement where QueryValue == (), From: PrimaryKeyedTable, Joins == () {
194+
/// Returns a single value fetched from the database for a given primary key.
195+
///
196+
/// - Parameters
197+
/// - db: A database connection.
198+
/// - primaryKey: A primary key identifying a table row.
199+
/// - Returns: A single value decoded from the database.
200+
@inlinable
201+
public func find(
202+
_ db: Database,
203+
key primaryKey: some QueryExpression<From.PrimaryKey>
204+
) throws -> From.QueryOutput {
205+
guard let record = try asSelect().find(primaryKey).fetchOne(db) else {
206+
throw NotFound()
207+
}
208+
return record
203209
}
204-
return record
205210
}
206-
}
211+
#endif
207212

208213
@available(iOS 17, macOS 14, tvOS 17, watchOS 10, *)
209214
extension SelectStatement where QueryValue == () {

Sources/SQLiteData/StructuredQueries+GRDB/Table+GRDB.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ extension StructuredQueriesCore.PrimaryKeyedTable {
5555
try all.find(db, key: primaryKey)
5656
}
5757
}
58-
#/
58+
*/
5959

6060
// NB: Swift 6.2.3 and 6.3-dev guard Select.find(_:) in swift-structured-queries due to compiler crashes.
6161
// This extension depends on that method, so it must also be guarded.

0 commit comments

Comments
 (0)