Skip to content

BugFix : Use Loop_left instead of Fold_while in compilng imperative loop; remove Fold_while completely

  • has a changelog entry

FOLD_WHILE is an ad-hoc constructor made by JDP to wrap michelson's LOOP with effect about 2y.o. Probably due to our back-end not being as expressive as it is now. The constant was pushing the loop code in a lambda on the stack and simply call it at each iteration. As a result, loop manipulating some types (big_map, sapling_state) could not be compiled.

This MR remove FOLD_WHILE which is not necessary anymore, recursive function should be use instead. The imperative loops now use michelson LOOP_LEFT which doesn't need to handle an effect on the stack.

N.B: the type_checking for LOOP_LEFT, LOOP_CONTINUE and LOOP_STOP is prone to errors, but as these are not expose to the user, this should be ok

Edited by Pierre-Emmanuel Wulfman

Merge request reports