Skip to content

Testing framework: make `Run` use `decompile_value` (typed)

E. Rivas requested to merge er433/test/type_decompile_value_in_run into dev

Motivation and Context

This MR resolves a remaining issue with record compilation that arises after issue #1508 (closed) was solved (see comment there).

Description

This MR uses the type to decompile results of Run (instead of just following the value), and also follows the strategy used in compilation of E_tuple for T_record.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement (non-breaking change that improves performance)
  • None (change with no changelog)

Changelog

Example file

$ cat test_record.ligo
type internal_storage is [@layout:comb] record [
  value : int;
]

type storage is record [
  internal_storage : internal_storage; 
]

const initial_storage: storage = record [
    internal_storage = record [
      value = 0;
    ];
  ];

const test_reproducing = {
  Test.log(Test.eval(initial_storage));
} with ("OK")

Before

$ ligo run test test_record.ligo 
Error(s) occurred while parsing the Michelson input:
At (unshown) location 0, value (Pair 0) is invalid for type int.
At (unshown) location 0, unexpected primitive, only an int can be used here. 

After

$ ligo run test test_record.ligo 
0                                           
Everything at the top-level was executed.
- test_reproducing exited with value "OK".

Checklist:

  • Changes follow the existing coding style (use dune @fmt to check).
  • Tests for the changes have been added (for bug fixes / feature).
  • Documentation has been updated.
  • Changelog description has been added (if appropriate).
  • Start titles under ## Changelog section with #### (if appropriate).
  • There is no image or uploaded file in changelog
  • Examples in changed behaviour have been added to the changelog (for breaking change / feature).
Edited by E. Rivas

Merge request reports