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
macOS Big Sur 11.3 (20E232)
Xcode Version 12.5 (12E262)
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: c803cb239fb04957e1b303199f40a2c1
Issue Description:
This code compiles normally, but if I uncomment one of the following print statements, or any other line, this will no longer compile, and throw the following error: Generic parameter 'T' could not be inferred
```
class Example {
static func test() {
Task.retry(task: { taskCompletion in
DispatchQueue.main.async {
//print("Uncomment me to throw error: Generic parameter 'T' could not be inferred")
taskCompletion(.success(()))
//print("Uncomment me to throw error: Generic parameter 'T' could not be inferred")
}
}, completion: { result in
switch result {
case .success:
print("success")
case .failure:
print("failure")
}
})
}
}
Environment
macOS Big Sur 11.3 (20E232)
Xcode Version 12.5 (12E262)
Additional Detail from JIRA
md5: c803cb239fb04957e1b303199f40a2c1
Issue Description:
This code compiles normally, but if I uncomment one of the following print statements, or any other line, this will no longer compile, and throw the following error: Generic parameter 'T' could not be inferred
```
class Example {
static func test() {
Task.retry(task: { taskCompletion in
DispatchQueue.main.async {
//print("Uncomment me to throw error: Generic parameter 'T' could not be inferred")
taskCompletion(.success(()))
//print("Uncomment me to throw error: Generic parameter 'T' could not be inferred")
}
}, completion: { result in
switch result {
case .success:
print("success")
case .failure:
print("failure")
}
})
}
}
enum Task {
static func retry<T>(
task: @escaping (_ completion: @escaping (Result<T, Error>) -> Void) -> Void,
completion: @escaping (Result<T, Error>) -> Void
) {
task { result in
completion(result)
}
}
}
```
The text was updated successfully, but these errors were encountered: