Skip to content

Commit 9e8acd2

Browse files
dmcyklorentey
authored andcommitted
[stdlib] Key path safe type hashing.
Uses ObjectIdentifier to extract metatype pointer, instead of unsafe pointer casting. (cherry picked from commit 3620ba3)
1 parent 33a22a0 commit 9e8acd2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/core/KeyPath.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class AnyKeyPath: Hashable, _AppendKeyPath {
5959
/// of this instance.
6060
@inlinable // FIXME(sil-serialize-all)
6161
final public func hash(into hasher: inout Hasher) {
62-
hasher.combine(unsafeBitCast(type(of: self) as Any.Type, to: Int.self))
62+
ObjectIdentifier(type(of: self)).hash(into: &hasher)
6363
return withBuffer {
6464
var buffer = $0
6565
while true {

0 commit comments

Comments
 (0)