Post

Replies

Boosts

Views

Activity

Bug Report: 'consume' Applied to Unsupported Value
'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) }
1
0
398
Jul ’24