Issue
I have a function with the following Swift code:
var allProducts: [FNCProduct] = []
try await withThrowingTaskGroup(of: [FNCProduct].self) { pageProductsTaskGroup in
// Some irrelevant code
for try await pageProducts in pageProductsTaskGroup {
allProducts.append(contentsOf: pageProducts)
}
}
return allProducts
This gets transpiled to the following Kotlin code:
var allProducts: Array<FNCProduct> = arrayOf()
withThrowingTaskGroup(of = Array::class) { pageProductsTaskGroup ->
// Some irrelevant code
for (pageProducts in pageProductsTaskGroup.sref()) {
allProducts.append(contentsOf = pageProducts)
}
}
return@l allProducts.sref()
I'm getting an error from the compiler that refers to the following line:
allProducts.append(contentsOf = pageProducts)
Argument type mismatch: actual type is 'skip.lib.Array<CapturedType(*)>', but 'skip.lib.Sequence<funico.module.FNCProduct>' was expected.
Proposed solution:
I think this:
withThrowingTaskGroup(of = Array::class)
needs to change to this:
withThrowingTaskGroup(of = Array<FNCProduct>::class)
Issue
I have a function with the following Swift code:
This gets transpiled to the following Kotlin code:
I'm getting an error from the compiler that refers to the following line:
allProducts.append(contentsOf = pageProducts)Argument type mismatch: actual type is 'skip.lib.Array<CapturedType(*)>', but 'skip.lib.Sequence<funico.module.FNCProduct>' was expected.
Proposed solution:
I think this:
needs to change to this: