[TM-100] Prettify types in storage/parameter when multi line printing
Description
Problem: The pretty printer does not pretty nested types
Solution: Add line breaks and indentation to the renderDoc
instance
of Michelson.Untyped.Type.T
. But this caused syntax errors when prettifying types embedded in instructions.
A sample
parameter key_hash;
storage (pair timestamp
(pair mutez
key_hash));
code { PUSH (lambda int <-- error here
int) { PUSH (lambda int
int) { UNIT; DROP }; DROP };
DROP;
DUP;
To fix this pretty printing of types was restricted to types in top level
storage and parameter fields of the contract. A newtype
wrapper was added to the Michelson.Printer.Util
module, to specify a slightly modified RenderDoc
instance that prints multiline, indented output for types.
Tests: Existing tests were modified with the new output. All the contracts in available in the repo were pretty printed and checked by alphanet.sh script.
Related issue(s)
https://issues.serokell.io/issue/TM-100
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
- [
✅ ] If I added new functionality, I added tests covering it. - [
✅ ] If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
- [
-
Documentation
Stylistic guide (mandatory)
- [
✅ ] My commits comply with the following policy. - [
✅ ] My code complies with the style guide.