Skip to content

Testing framework: issue with long tuples in matching

Motivation and Context

It was reported by Smartchain a problem with long tuples in the setting of the testing framework.

Description

This MR fixes the issue by using the record destructor Record.tuple_of_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 tuple_long.mligo 
type big_tuple = int * int * int * int * int * int * int * int * int * int * int * int

let br : big_tuple = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)

let f (x : big_tuple) =
  match x with
  | (x0, _x1, _x2, _x3, _x4, _x5, _x61, _x7, _x8, _x9, _x45, _x111) -> x0

let test = Test.assert (f br = 0)

Before fix

$ ligo run test tuple_long.mligo 
File "tuple_long.mligo", line 9, characters 24-28:
  8 | 
  9 | let test = Test.assert (f br = 0)

No pattern matched

After fix

$ ligo run test tuple_long.mligo 
Everything at the top-level was executed.   
- test exited with value ().

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

Loading