Improved Result Builder Implementation in Swift 5.8

I'm surprised that it worked before and I don't know that type did the transform use, it looks like one of the examples where the compiler allowed something it shouldn't have. As written your example would synthesize an array variable that infers its element type from the body of for-in loop, the value that gets passed to synthesized .append(...) call would have type some View which we cannot use as an element type for the array variable, transform looks something like this:

func test() -> some View {
    let __builder0: ArrayContent<some View>
    var __array: [some View] = []
    for _ in 0...10 {
        let __builder1 = createView()
        let __builder2 = ViewBuilder.buildBlock(__builder1)
        __array.append(__builder2)
    }

    __builder0 = ViewBuilder.buildArray(__array)
    return ViewBuilder.buildBlock(__builder0)
}
1 Like