Skip to content

Commit fd3aef5

Browse files
committed
QueryEngine: Calculate stable hashes for Foundation.URL and FoundationEssentials.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
1 parent bde8791 commit fd3aef5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/Helpers/Vendor/QueryEngine/CacheKey.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ extension FilePath.Component: LeafCacheKey {
167167

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

0 commit comments

Comments
 (0)