You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then I create an implicitly unwrapped optional of this type, and cast it to 'Any':
letmyObject: MyClass! = MyClass() // MyClassletmyAny: Any = myObject// MyClass
Now trying to cast the 'myAny' instance to the protocol 'MyProtocol' that it conforms to, produces 'nil', while casting 'myObject' to the same protocol returns proper object:
This is similar to SR-3871, but not quite the same. SR-3871 specifically is about nested Any/AnyObject existential containers. This is similar but with Optionals in the mix. It interacts with the current `print()` implementation in complex ways, so it will take me a little while to work out a good approach here.
#33561 should fix this for the non-optimized case (where the cast is being handled by the runtime). There may still be issues with optimized casts, though.
Environment
Xcode 8.3, Xcode 8.3.1
Additional Detail from JIRA
md5: ef0c9e8e254e8f3add523707285a627b
relates to:
Issue Description:
I have a protocol, and class:
Then I create an implicitly unwrapped optional of this type, and cast it to 'Any':
Now trying to cast the 'myAny' instance to the protocol 'MyProtocol' that it conforms to, produces 'nil', while casting 'myObject' to the same protocol returns proper object:
Same code works properly with Swift 3.0
The text was updated successfully, but these errors were encountered: