Skip to content

Commit 542d515

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 542d515

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/Helpers/Vendor/QueryEngine/CacheKey.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ extension FilePath.Component: LeafCacheKey {
168168
extension URL: LeafCacheKey {
169169
func hash(with hashFunction: inout some HashFunction) {
170170
String(reflecting: Self.self).hash(with: &hashFunction)
171+
172+
// Until Swift 6.0, the fully-qualified name of the URL type was `Foundation.URL`.
173+
// After the adoption of FoundationEssentials, the name changed to `FoundationEssentials.URL`.
174+
// This difference causes the hashes to change, so for backwards compatibility we pin the
175+
// type name to `Foundation.URL`.
176+
"Foundation.URL".hash(with: &hashFunction)
171177
self.description.hash(with: &hashFunction)
172178
}
173179
}

0 commit comments

Comments
 (0)