[SR-2453] Optional<T> as? AnyObject breaks in Swift 3 #45058
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
regression
swift 3.0
type checker
Area → compiler: Semantic analysis
Environment
Xcode 8 beta 6
Additional Detail from JIRA
md5: e5ec372253da24e4c63703915f06834f
duplicates:
Issue Description:
Swift 3’s auto-wrapping of Swift values as objects when casting to AnyObject produces surprising (and breaking) behavior when casting from Optional.
In Swift 2,
as? AnyObject
would unwrap an optional to check whether the wrapped value is an object. In Swift 3, the same syntax wraps the Optional itself in an object. This gives surprising behavior for===
:This regression introduced several insidious bugs in Siesta, and also seems to affect Nimble.
The text was updated successfully, but these errors were encountered: