We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 36ab596 + 5074504 commit 4f3f73bCopy full SHA for 4f3f73b
test/Casting/Casts.swift
@@ -1051,4 +1051,17 @@ CastsTests.test("Do not overuse __SwiftValue (non-ObjC)") {
1051
expectNotNil(runtimeCast(b, to: Foo.self))
1052
}
1053
1054
+CastsTests.test("Don't put AnyHashable inside AnyObject") {
1055
+ class C: Hashable {
1056
+ func hash(into hasher: inout Hasher) {}
1057
+ static func ==(lhs: C, rhs: C) -> Bool { true }
1058
+ }
1059
+ let a = C()
1060
+ let b = AnyHashable(a)
1061
+ let c = a as! AnyObject
1062
+ expectTrue(a === c)
1063
+ let d = c as! C
1064
+ expectTrue(a === d)
1065
+}
1066
+
1067
runAllTests()
0 commit comments