[SR-3505] Optional of a wrapped type with value nil is incorrectly considered to be an Optional of another wrapped type #46093
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
casting
Feature: explicit casting (is, as, as? and as!)
compiler
The Swift compiler itself
Optional
Area → standard library: The `Optional` type
type checker
Area → compiler: Semantic analysis
Attachment: Download
Environment
OS X 10.11.6 (15G1212)
Xcode 8.2 (8C38)
IBM Swift Sandbox - Swift Ver. 3.0.2 (Release) - Platform: Linux (x86_64)
Additional Detail from JIRA
md5: e9915be07f69d31b7fe68a41773d1454
relates to:
Issue Description:
The output from the following code is reasonable to me except for the last line producing "true".
The compiler even issues warning "Cast from 'Optional<Int>' to unrelated type 'Optional<String>' always fails" for the last line, as it does for the lines producing "false", yet the result is "true".
The text was updated successfully, but these errors were encountered: