when you do something like
with if_else as (then, otherwise):
with then as then_block:
<<code>>
with otherwise as otherwise_block:
<<code>>
the 'then_block' and 'otherwise_block' above are references to the same block, which is the endif block. I don't understand the motivation for that choice. If those blocks were actually the 'if' and 'else' blocks they could be more useful. For example you could do something like...
with builder.if_else as (then, otherwise):
with then as then_block:
var1 = builder.add(x,y)
with otherwise as otherwise_block:
var2 = builder.add(i, j)
phi = builder.phi()
phi.add_incoming(var1, then_block)
phi.add_incoming(var2, otherwise_block)
Does this seem like a good idea? The code change to do this is trivial (I'm using it in a forked repo). I'd be happy to create a PR if this would be useful to more people. All of the tests still pass in my forked version and I looked through the numba codebase and I couldn't find any instances where the yielded value of the then and otherwise was even being captured.