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
enum SomeError : ErrorType {
case Error
}
enum SomethingOrError<T> {
case err(SomeError)
case some(T)
}
func doit() -> SomethingOrError<Int> {
return SomethingOrError.some(0)
}
func doit() throws -> Int {
return 0
}
let something = try! doit()
You get:
t.swift:18:22: error: ambiguous use of 'doit()'
let something = try! doit()
^
t.swift:10:6: note: found this candidate
func doit() -> SomethingOrError<Int> {
^
t.swift:14:6: note: found this candidate
func doit() throws -> Int {
^
Consider guiding type inference to resolve the call to the throwing function since the call uses 'try'.
The text was updated successfully, but these errors were encountered:
Since you're allowed to put try around a whole expression, I'm not convinced this is (1) implementable, or (2) a good idea. I don't think we can reasonably count try as a "contextual type" that implies something throws.
Additional Detail from JIRA
md5: 9004a0727c0e0a404b014393e17c9bce
Issue Description:
With this code:
You get:
Consider guiding type inference to resolve the call to the throwing function since the call uses 'try'.
The text was updated successfully, but these errors were encountered: