Skip to content

Commit

Permalink
QueryEngine: Calculate stable hashes for Foundation.URL and Foundatio…
Browse files Browse the repository at this point in the history
…nEssentials.URL

Until Swift 6.0, the fully-qualified name of the URL type was
`Foundation.URL`.  After the adoption of FoundationEssentials, the
name changed to `FoundationEssentials.URL`.  This difference causes
the hashes to change, so for backwards compatibility we pin the
type name to `Foundation.URL`.

Fixes #45
  • Loading branch information
euanh committed Nov 8, 2024
1 parent bde8791 commit fd3aef5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Helpers/Vendor/QueryEngine/CacheKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ extension FilePath.Component: LeafCacheKey {

extension URL: LeafCacheKey {
func hash(with hashFunction: inout some HashFunction) {
String(reflecting: Self.self).hash(with: &hashFunction)
// Until Swift 6.0, the fully-qualified name of the URL type was `Foundation.URL`.
// After the adoption of FoundationEssentials, the name changed to `FoundationEssentials.URL`.
// This difference causes the hashes to change, so for backwards compatibility we pin the
// type name to `Foundation.URL`.
"Foundation.URL".hash(with: &hashFunction)
self.description.hash(with: &hashFunction)
}
}

0 comments on commit fd3aef5

Please sign in to comment.