You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
funcaFunction() -> Int? { return5 }
funcbFunction() throws -> Int { return4 }
letvalue = aFunction() ?? trybFunction() // ERROR: Operator can throw but expression is not marked with a ‘try'print(value)
The workaround is to place 'try' before the entire expression:
letvalue = tryaFunction() ?? bFunction()
This is awkward, because `aFunction` isn't throwable; `bFunction` is. We ought to be able to place the `try` before `bFunction()` and have that propagate out.
The '??' operator is implemented with a rethrowing autoclosure:
Environment
Swift 3.0
Additional Detail from JIRA
md5: a92d394202d798ec2b328dc8aa2d0161
Issue Description:
You might expect the following code to work:
The workaround is to place 'try' before the entire expression:
This is awkward, because `aFunction` isn't throwable; `bFunction` is. We ought to be able to place the `try` before `bFunction()` and have that propagate out.
The '??' operator is implemented with a rethrowing autoclosure:
The behaviour would likely make sense for all functions which rethrow from autoclosures.
The text was updated successfully, but these errors were encountered: