Merge branch 'fix-reasonligo-functiontype-parsing' into 'dev'
fix annotation for funciton in ReasonLigo Closes #164 See merge request ligolang/ligo!489
This commit is contained in:
commit
6a09ac866c
@ -310,7 +310,7 @@ let main (action, store: parameter * storage) : return =
|
||||
```reasonligo group=c
|
||||
let owner : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address);
|
||||
|
||||
let main = ((action, store) : (parameter, storage)) : storage => {
|
||||
let main = ((action, store) : (parameter, storage)) : return => {
|
||||
if (Tezos.source != owner) { (failwith ("Access denied.") : return); }
|
||||
else { (([] : list (operation)), store); };
|
||||
};
|
||||
@ -478,4 +478,3 @@ let proxy = ((action, store): (parameter, storage)) : return => {
|
||||
> *deprecated*.
|
||||
|
||||
</Syntax>
|
||||
|
||||
|
@ -558,9 +558,13 @@ fun_expr:
|
||||
in raise (Error (WrongFunctionArguments e))
|
||||
in
|
||||
let binders = fun_args_to_pattern $1 in
|
||||
let lhs_type = match $1 with
|
||||
EAnnot {value = {inside = _ , _, t; _}; region = r} -> Some (r,t)
|
||||
| _ -> None
|
||||
in
|
||||
let f = {kwd_fun;
|
||||
binders;
|
||||
lhs_type=None;
|
||||
lhs_type;
|
||||
arrow;
|
||||
body
|
||||
}
|
||||
|
@ -828,6 +828,18 @@ and simpl_declaration : Raw.declaration -> declaration Location.wrap list result
|
||||
ok (Raw.EFun {region=Region.ghost ; value=fun_},List.fold_right' aux lhs_type' ty)
|
||||
in
|
||||
let%bind rhs' = simpl_expression let_rhs in
|
||||
let%bind lhs_type = match lhs_type with
|
||||
| None -> (match let_rhs with
|
||||
| EFun {value={binders;lhs_type}} ->
|
||||
let f_args = nseq_to_list (binders) in
|
||||
let%bind lhs_type' = bind_map_option (fun x -> simpl_type_expression (snd x)) lhs_type in
|
||||
let%bind ty = bind_map_list typed_pattern_to_typed_vars f_args in
|
||||
let aux acc ty = Option.map (t_function (snd ty)) acc in
|
||||
ok @@ (List.fold_right' aux lhs_type' ty)
|
||||
| _ -> ok None
|
||||
)
|
||||
| Some t -> ok @@ Some t
|
||||
in
|
||||
ok @@ [loc x @@ (Declaration_constant (Var.of_name var.value , lhs_type , inline, rhs'))]
|
||||
)
|
||||
|
||||
|
@ -12,7 +12,7 @@ generated. unrecognized constant: {"constant":"BALANCE","location":"generated"}
|
||||
|
||||
type storage = tez;
|
||||
|
||||
let main2 = (p : unit, storage) =>
|
||||
let main2 = (p : unit, s: storage) =>
|
||||
([]: list (operation), Tezos.balance);
|
||||
|
||||
let main = (x : (unit, storage)) => main2 (x[0], x[1]);
|
||||
|
@ -6,10 +6,10 @@ let literal_op = (p: unit) : set (string) =>
|
||||
let add_op = (s: set (string)) : set (string) =>
|
||||
Set.add ("foobar", s);
|
||||
|
||||
let remove_op = (s: set (string)) : set(string) =>
|
||||
let remove_op = (s: set (string)) : set (string) =>
|
||||
Set.remove ("foobar", s);
|
||||
|
||||
let remove_deep = (s: (set (string), nat)): (set (string), nat) =>
|
||||
let remove_deep = (s: (set (string), nat)): set (string) =>
|
||||
Set.remove ("foobar", s[0]);
|
||||
|
||||
let mem_op = (s: set (string)) : bool =>
|
||||
|
Loading…
Reference in New Issue
Block a user