1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00
ZoKrates/zokrates_cli/examples/compile_errors/block_result_propagation.zok

10 lines
418 B
Text

def throwing_bound<N>(u32 x) -> u32:
assert(x == N)
return 1
// this should compile: the conditional, even though it can throw, has a constant compile-time value `1`
// the value of the blocks should be propagated out, so that `if x == 0 then 1 else 1 fi` can be determined to be `1`
def main(u32 x):
for u32 i in 0..if x == 0 then throwing_bound::<0>(x) else throwing_bound::<1>(x) fi do
endfor
return