'consume' applied to value that the compiler does not support. This is a compiler bug. Please file a bug with a small example of the bug.
public func requestTopicsAndSubTopics() async throws -> (topics: [Topic], subTopics: [String: [SubTopic]]) {
var subTopics = [String: [SubTopic]]()
let topics = try await getTopics().sorted { $0.index < $1.index }
try await withThrowingTaskGroup(of: ([SubTopic], String).self) { [weak self] group in
guard let self else { return }
for topic in topics {
guard let topicId = topic.id else { throw Error.missingId }
group.addTask {
let subTopics = try await self.getSubtopics(topicId: topicId).sorted { $0.name < $1.name }
return (consume subTopics, topicId)
}
}
for try await (resultedSubTopics, topicId) in group {
subTopics.updateValue(resultedSubTopics, forKey: topicId)
}
}
return (consume topics, consume subTopics)
}
DevForums is not the right place to report bugs. For info on how to do that, see my Bug Reporting: How and Why? post. In this case I recommend that you use the Swift open source bug reporting system, because that’ll let you track your bug’s status.
Please post your bug number, just for the record.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"