Skip to content

Proto/Michelson: fix `PAIR k` annots

Tom Jack requested to merge tomjack/tezos:fix-pairk-annots into master

Context

The PAIR k instruction currently converts @ annotations on the stack to % annotations. For example, PAIR 2 works like PAIR %@ %@.

This causes troubles with typing, for example, this typechecks:

{ parameter unit;
  storage unit;
  code { SENDER @foo; SOURCE @bar; PAIR 2;
         SOURCE @foo; SENDER @bar; PAIR 2;
         COMPARE; DROP;
         CDR; NIL operation; PAIR } }

but it fails to typecheck if the @foo and @bar annots are removed.

This makes it difficult to use PAIR k in a compiler, because it may cause type errors.

This change fixes the problem by merely removing the behavior. PAIR k will put no % annotations at all on the result.

An alternative could be to allow the user to specify the field annotations (allowing the user to opt in to the current behavior using %@) but this does not seem important.

Checklist

  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, the Development Version section of CHANGES.md for everything else).
  • Select suitable reviewers using the Reviewers field below.
Edited by Tom Jack

Merge request reports

Loading