[SR-6286] AnyHashable casting error in Swift 3.2/Swift 4 #48836
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
standard library
Area: Standard library umbrella
Attachment: Download
Environment
Xcode 9.0.0 with Swift 3.2/4.0
Xcode 9.0.1 with Swift 3.2/4.0
Xcode 9.1.0 with Swift 3.2/4.0
Xcode 9.2.0 Beta with Swift 3.2/4.0
Additional Detail from JIRA
md5: f4c2c8bdd4af3e711bf7d1c2f26ae7e8
Issue Description:
Summary
I posted this as a radar on Oct. 4th, but haven't seen any motion on it. I've already factored out AnyHashable from our codebase; but, would like to reintroduce it as removing it created more complexity.
Swift 3.1: Behaves as expected.
Swift 3.2/Swift 4: AnyHashable's casting behavior fails with Swift classes. Structs and NSObject classes behave correctly.
Steps to Reproduce
Create two Swift classes, conforming to Hashable.
Instantiate two AnyHashable objects, each using a different object type (from Redundant Load Elimination Patches #1).
Cast an AnyHashable object to the other's class type.
Result should be nil.
Example
Expected results:
Actual results, Swift 3.2/4.0 is incorrect:
The text was updated successfully, but these errors were encountered: