Confusion about buildEither of result builder

I'm learning result builder. This part of the doc
confuses me:
--- Quote Start ---

  • A branch statement becomes a series of nested calls to the buildEither(first:) and buildEither(second:)methods. The statements’ conditions and cases are mapped onto the leaf nodes of a binary tree, and the statement becomes a nested call to the buildEither methods following the path to that leaf node from the root node.For example, if you write a switch statement that has three cases, the compiler uses a binary tree with three leaf nodes. Likewise, because the path from the root node to the second case is “second child” and then “first child”, that case becomes a nested call like buildEither(first: buildEither(second: ... )). The following declarations are equivalent:
let someNumber = 19
@ArrayBuilder var builderConditional: [Int] {
    if someNumber < 12 {
        31
    } else if someNumber == 19 {
        32
    } else {
        33
    }
}


var manualConditional: [Int]
if someNumber < 12 {
    let partialResult = ArrayBuilder.buildExpression(31)
    let outerPartialResult = ArrayBuilder.buildEither(first: partialResult)
    manualConditional = ArrayBuilder.buildEither(first: outerPartialResult)
} else if someNumber == 19 {
    let partialResult = ArrayBuilder.buildExpression(32)
    let outerPartialResult = ArrayBuilder.buildEither(second: partialResult)
    manualConditional = ArrayBuilder.buildEither(first: outerPartialResult)
} else {
    let partialResult = ArrayBuilder.buildExpression(33)
    manualConditional = ArrayBuilder.buildEither(second: partialResult)
}

--- Quote End ---

I thought

    if someNumber < 12 {
        31
    } else if someNumber == 19 {
        32
    } else {
        33
    }

is interpreted as

if someNumber < 12 {
    31
} else {
    if someNumber == 19 {
        32
    } else {
        33
    }
}

and it should be

var manualConditional: [Int]
if someNumber < 12 {
    let partialResult = ArrayBuilder.buildExpression(31)
    let manualConditional = ArrayBuilder.buildEither(first: partialResult)
} else if someNumber == 19 {
    let partialResult = ArrayBuilder.buildExpression(32)
    let outerPartialResult = ArrayBuilder.buildEither(first: partialResult)
    manualConditional = ArrayBuilder.buildEither(second: outerPartialResult)
} else {
    let partialResult = ArrayBuilder.buildExpression(33)
    let outerPartialResult = ArrayBuilder.buildEither(second: partialResult)
    manualConditional = ArrayBuilder.buildEither(second: outerPartialResult)
}

but it seems it is interpreted as

if what-goes-here {
    if someNumber < 12 {
        31
    } else if someNumber == 19 {
        32
    } 
} else {
    33
}

which doesn't seem right to me.

The proposal says it builds a "balanced binary tree", which necessitates such a transformation if there are four or more total branches -- if an if-else chain were translated naively, it wouldn't form a balanced tree. The fact that it does this for exactly three branches seems to be, as far as I can tell, an implementation detail that doesn't strictly matter.

Also “balanced binary tree” is underspecified, because for example AVL trees and red black trees use a different definition of “balanced”. Perhaps the authors inserted the word “balanced” on accident when they just meant to say “binary tree”.

Huh, TIL. AVL trees were never brought up in any data structures course I've taken.