[SR-912] Runtime exception casting an Any nil to an Optional. #43524
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
crash
Bug: A crash, i.e., an abnormal termination of software
run-time crash
Bug → crash: Swift code crashed during execution
runtime
The Swift Runtime
standard library
Area: Standard library umbrella
Environment
xcode 7.3 beta 5
os x 10.11.3
Additional Detail from JIRA
md5: dfee632a8b003f40faceb3a233e6d950
Issue Description:
Example
Code below demonstrate type casting of 'Any' object to generic type. Conversion completed successful if optional types have concrete not nil value. If object value equal to nil then conversion to Int32? type by "as!" operator will throw exception.
Code Example
Result for xCode Version 7.2 (7C68) / osX 10.10.5 (14F1509)
as expected code above gave next result
Optional(Optional(1))
Optional(1)
Optional(nil)
nil
The text was updated successfully, but these errors were encountered: