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
{{ message }}
This repository has been archived by the owner on Jan 17, 2019. It is now read-only.
Possible issue – as? is also used with if let in Swift, so the above might be confusing if let x: Int = (call? ext.foobar()) as? Int { ... – is the else branch taken when the calls fails or when the type cast fails?
The text was updated successfully, but these errors were encountered:
If we have Swift semantics with optionals this'd give you an error because you're trying to cast an optional type to a non-optional, optionally.
If foobar returns an int256, say, then after call you would expect to have an int256?. However Int is not an optional type, so even a forced cast would crash the compiler. There's no way for this to work. If you do as! Int? then obviously you would expect x to be of type Int?, which resolves the ambiguity here.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
E.g.:
Possible issue –
as?
is also used withif let
in Swift, so the above might be confusingif let x: Int = (call? ext.foobar()) as? Int { ...
– is theelse
branch taken when the calls fails or when the type cast fails?The text was updated successfully, but these errors were encountered: