Skip to content

JsLIGO: make compile_parameter use patterns instead of accessors in abstractor

E. Rivas requested to merge er433/fix/jsligo-compile_parameter into dev

type:none

As reported by Benjamin, the error message for non-matching number of arguments in type/parameters is difficult to grasp, e.g.

let foo = ([a,b,c,d] : [int,int,int]) : int => a + b + c + d;

fails with

Invalid record field "3" in record "#193". 

In JsLIGO, compile_parameter works by using accessors instead of patterns. This MR changes the behaviour, obtaining the error similar to other syntax:

   File "../../test/contracts/negative/pattern_match6.jsligo", line 1, characters 11-20:
     1 | let foo = ([a,b,c,d] : [int,int,int]) : int => a + b + c + d;
 
   Pattern not of the expected type ( int * int * int ) |}]
  • has a changelog entry
Edited by Laurent Canis

Merge request reports