[SR-4248] Runtime exception casting an Any? nil to a generic optional #46831
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
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
Environment
Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
md5: adedc48208df41d3ff061c642c889341
is duplicated by:
relates to:
Any?
toas? Value
where Value == Any produces unexpected result in Xcode 10Issue Description:
Summary
An unexpected fatal error in a forced downcast from a
nil
to an optional generic typeT
, e.g.T = String?
.NOTE: Casting
nil as Any
before the forced downcast is a workaround to avoid the runtime fatal error. Perhaps this in itself is its own bug?NOTE: This is similar to a previously reported and resolved bug: https://bugs.swift.org/browse/SR-912 — in this case, the input type is
Any
and notAny?
.Code Example
The text was updated successfully, but these errors were encountered: