[SR-1024] Type of optionals cannot be inferred correctly in swift 2.2 #43636
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
optimized only
Flag: An issue whose reproduction requires optimized compilation
regression
swift 2.2
Environment
Xcode 7.3
Swift 2.2
Additional Detail from JIRA
md5: 2db3fa276c0751b3d29d768627bffb8d
is duplicated by:
Issue Description:
Problem:
When running the following code under Xcode 7.3 with swift 2.2, the compiler is unable to correctly infer the type of the optional:
On my side with Xcode 7.3 this will print `I am an Int?`
However, when I initialize the variable with an empty string before passing it to the function, the switch infers it to be a String?.
This would print `I am a String?` in the previous Xcode version.
Another example:
Stackoverflow question: http://stackoverflow.com/questions/36160934/type-of-optionals-cannot-be-inferred-correctly-in-swift-2-2
The text was updated successfully, but these errors were encountered: