-
Notifications
You must be signed in to change notification settings - Fork 0
fix: Use explicit Package.Dependency type to avoid Swift 6.2.3 circular reference bug #11
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
Changes from all commits
5063f95
3b66e1d
1613b46
30603d9
24097cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,8 +30,8 @@ let package = Package( | |
| .package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.0.0"), | ||
| .package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.3.3"), | ||
| .package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.9.0"), | ||
| // NB: Fork with Swift 6.3 fixes (uses doozMen/swift-perception) | ||
| .package(url: "https://github.com/doozMen/swift-sharing", branch: "main"), | ||
| // NB: Fork with Swift 6.3 fixes | ||
| .package(url: "https://github.com/doozMen/swift-sharing", branch: "fix/swift-623-optimizer-crash"), | ||
| .package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.18.4"), | ||
|
Comment on lines
+33
to
35
|
||
| // NB: Fork with Swift 6.3 fixes | ||
| .package( | ||
|
|
@@ -70,9 +70,6 @@ let package = Package( | |
| "SQLiteData", | ||
| .product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"), | ||
| .product(name: "CustomDump", package: "swift-custom-dump"), | ||
| .product(name: "Perception", package: "swift-perception"), | ||
| .product(name: "Sharing", package: "swift-sharing"), | ||
| .product(name: "StructuredQueriesSQLite", package: "swift-structured-queries"), | ||
| ] | ||
| ), | ||
| .testTarget( | ||
|
|
@@ -82,7 +79,6 @@ let package = Package( | |
| "SQLiteDataTestSupport", | ||
| .product(name: "DependenciesTestSupport", package: "swift-dependencies"), | ||
| .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), | ||
| package: "swift-tagged", | ||
| .product(name: "SnapshotTestingCustomDump", package: "swift-snapshot-testing"), | ||
| .product(name: "StructuredQueries", package: "swift-structured-queries"), | ||
| ] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,24 +186,29 @@ extension SelectStatement where QueryValue == (), Joins == () { | |
| } | ||
| } | ||
|
|
||
| extension SelectStatement where QueryValue == (), From: PrimaryKeyedTable, Joins == () { | ||
| /// Returns a single value fetched from the database for a given primary key. | ||
| /// | ||
| /// - Parameters | ||
| /// - db: A database connection. | ||
| /// - primaryKey: A primary key identifying a table row. | ||
| /// - Returns: A single value decoded from the database. | ||
| @inlinable | ||
| public func find( | ||
| _ db: Database, | ||
| key primaryKey: some QueryExpression<From.PrimaryKey> | ||
| ) throws -> From.QueryOutput { | ||
| guard let record = try asSelect().find(primaryKey).fetchOne(db) else { | ||
| throw NotFound() | ||
| // NB: Swift 6.2.3 and 6.3-dev guard Select.find(_:) in swift-structured-queries due to compiler crashes. | ||
| // This extension depends on that method, so it must also be guarded. | ||
| // Tracking: https://github.com/swiftlang/swift/issues/82529 | ||
| #if !compiler(>=6.2.3) | ||
| extension SelectStatement where QueryValue == (), From: PrimaryKeyedTable, Joins == () { | ||
|
Comment on lines
+189
to
+193
|
||
| /// Returns a single value fetched from the database for a given primary key. | ||
| /// | ||
| /// - Parameters | ||
| /// - db: A database connection. | ||
| /// - primaryKey: A primary key identifying a table row. | ||
| /// - Returns: A single value decoded from the database. | ||
| @inlinable | ||
| public func find( | ||
| _ db: Database, | ||
| key primaryKey: some QueryExpression<From.PrimaryKey> | ||
| ) throws -> From.QueryOutput { | ||
| guard let record = try asSelect().find(primaryKey).fetchOne(db) else { | ||
| throw NotFound() | ||
| } | ||
| return record | ||
| } | ||
| return record | ||
| } | ||
| } | ||
| #endif | ||
|
|
||
| @available(iOS 17, macOS 14, tvOS 17, watchOS 10, *) | ||
| extension SelectStatement where QueryValue == () { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dependency on the third-party package
swift-sharingis pinned to a mutable Git branch (branch: "fix/swift-623-optimizer-crash"), which means future builds will automatically pick up any new commits pushed to that branch. If thedoozMen/swift-sharingrepository or this branch is ever compromised, an attacker can silently inject malicious code into your build artifacts without any change to this repository. To mitigate this supply-chain risk, pin the dependency to an immutable reference such as a specific tagged version or commit SHA and only update it intentionally after review.