Open idrougge opened 5 years ago
This is behaving as expected, with try?
having a lower precedence than ??
to be consistent with try
. I admit it's not so useful in this case, though.
Any change here would have to go through the Swift Evolution Process.
Environment
Xcode 10.3 (10G8), Swift 5Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, LanguageFeatureRequest | |Assignee | None | |Priority | Medium | md5: de8ec3fb2fc24920ffff647e79d3f055Issue Description:
Given a throwing function, e.g.:
Calling it using try? and handling the resulting optional using the ?? operator will not resolve to a non-optional:
…instead giving the error message
…as well as a fixit to replace try? with try!.
In Xcode, the function name will also not be highlighted as a function name until you apply the fixit, turning "try?" into "try!".
Wrapping the call in parentheses, e.g.:
…the code will highlight and compile, but the expression should be solvable without.