clean-up junk
This commit is contained in:
parent
51251f9464
commit
a5f44d3e88
@ -1174,7 +1174,7 @@ let%expect_test _ =
|
||||
let%expect_test _ =
|
||||
run_ligo_bad [ "compile-contract" ; bad_contract "create_contract_toplevel.mligo" ; "main" ] ;
|
||||
[%expect {|
|
||||
ligo: in file "create_contract_toplevel.mligo", line 4, character 35 to line 8, character 8. No free variable allowed in this lambda: variable 'store' {"expression":"CREATE_CONTRACT(lambda (#P:Some(( nat * string ))) : None return let rhs#809 = #P in let p = rhs#809.0 in let s = rhs#809.1 in ( list[] : (TO_list(operation)) , store ) , NONE() : (TO_option(key_hash)) , 300000000mutez , \"un\")","location":"in file \"create_contract_toplevel.mligo\", line 4, character 35 to line 8, character 8"}
|
||||
ligo: in file "create_contract_toplevel.mligo", line 4, character 35 to line 8, character 8. No free variable allowed in this lambda: variable 'store' {"expression":"CREATE_CONTRACT(lambda (#P:Some(( nat * string ))) : None return let rhs#808 = #P in let p = rhs#808.0 in let s = rhs#808.1 in ( list[] : (TO_list(operation)) , store ) , NONE() : (TO_option(key_hash)) , 300000000mutez , \"un\")","location":"in file \"create_contract_toplevel.mligo\", line 4, character 35 to line 8, character 8"}
|
||||
|
||||
|
||||
If you're not sure how to fix this error, you can
|
||||
@ -1187,7 +1187,7 @@ ligo: in file "create_contract_toplevel.mligo", line 4, character 35 to line 8,
|
||||
|
||||
run_ligo_bad [ "compile-contract" ; bad_contract "create_contract_var.mligo" ; "main" ] ;
|
||||
[%expect {|
|
||||
ligo: in file "create_contract_var.mligo", line 6, character 35 to line 10, character 5. No free variable allowed in this lambda: variable 'a' {"expression":"CREATE_CONTRACT(lambda (#P:Some(( nat * int ))) : None return let rhs#812 = #P in let p = rhs#812.0 in let s = rhs#812.1 in ( list[] : (TO_list(operation)) , a ) , NONE() : (TO_option(key_hash)) , 300000000mutez , 1)","location":"in file \"create_contract_var.mligo\", line 6, character 35 to line 10, character 5"}
|
||||
ligo: in file "create_contract_var.mligo", line 6, character 35 to line 10, character 5. No free variable allowed in this lambda: variable 'a' {"expression":"CREATE_CONTRACT(lambda (#P:Some(( nat * int ))) : None return let rhs#811 = #P in let p = rhs#811.0 in let s = rhs#811.1 in ( list[] : (TO_list(operation)) , a ) , NONE() : (TO_option(key_hash)) , 300000000mutez , 1)","location":"in file \"create_contract_var.mligo\", line 6, character 35 to line 10, character 5"}
|
||||
|
||||
|
||||
If you're not sure how to fix this error, you can
|
||||
|
@ -182,14 +182,10 @@ let parse_expression (s: string) =
|
||||
let ext = PreIO.ext
|
||||
let options = PreIO.pre_options ~input:None ~expr:true
|
||||
end in
|
||||
Format.printf "coucou : %s\n%!" s;
|
||||
let module Unit = PreUnit (IO) in
|
||||
match Lexer.(open_token_stream @@ String s) with
|
||||
Ok instance ->
|
||||
let thunk () = Unit.apply instance Unit.parse_expr
|
||||
in
|
||||
Format.printf "ok\n%!";
|
||||
parse (module IO) thunk
|
||||
in parse (module IO) thunk
|
||||
| Stdlib.Error (Lexer.File_opening msg) ->
|
||||
Format.printf "fail\n%!";
|
||||
Trace.fail @@ Errors.generic @@ Region.wrap_ghost msg
|
||||
|
@ -847,11 +847,11 @@ and simpl_declaration : Raw.declaration -> declaration Location.wrap list result
|
||||
in ok @@ decls
|
||||
| PPar {region = _ ; value = { lpar = _ ; inside = pt; rpar = _; } } ->
|
||||
(* Extract parenthetical multi-bind *)
|
||||
let (wild, _rec, _, attributes) = fst @@ r_split x in
|
||||
let (wild, recursive, _, attributes) = fst @@ r_split x in
|
||||
simpl_declaration
|
||||
(Let {
|
||||
region = x.region;
|
||||
value = (wild, _rec, {binders = (pt, []);
|
||||
value = (wild, recursive, {binders = (pt, []);
|
||||
lhs_type = lhs_type;
|
||||
eq = Region.ghost ;
|
||||
let_rhs = let_rhs}, attributes)}
|
||||
|
@ -642,7 +642,6 @@ and transpile_recursive {fun_name; fun_type; lambda} =
|
||||
let loop_type = t_union (None, input_type) (None, output_type) in
|
||||
let%bind (body,binder) = map_lambda fun_name loop_type lambda.result in
|
||||
let binder = lambda.binder::binder in
|
||||
List.iter (Format.printf "inder %a\n%!" Var.pp) binder ;
|
||||
let%bind binder = match binder with hd::[] -> ok @@ hd | _ -> fail @@ unsupported_recursive_function fun_name in
|
||||
let expr = Expression.make_tpl (E_variable binder, input_type) in
|
||||
let body = Expression.make (E_iterator (C_LOOP_LEFT, ((lambda.binder, loop_type),body), expr)) output_type in
|
||||
|
@ -349,8 +349,7 @@ module Simplify = struct
|
||||
|
||||
(* Loop module *)
|
||||
|
||||
| "Loop.fold_while" -> ok C_FOLD_WHILE
|
||||
| "Loop.loop_left" -> ok C_LOOP_LEFT
|
||||
| "Loop.fold_while" -> ok C_FOLD_WHILE (* Deprecated *)
|
||||
| "Loop.resume" -> ok C_FOLD_CONTINUE
|
||||
| "continue" -> ok C_FOLD_CONTINUE (* Deprecated *)
|
||||
| "Loop.stop" -> ok C_FOLD_STOP
|
||||
@ -485,7 +484,6 @@ module Typer = struct
|
||||
|
||||
let t_continuation = forall "a" @@ fun a -> tuple2 bool a --> pair bool a
|
||||
let t_fold_while = forall "a" @@ fun a -> tuple2 (a --> pair bool a) a --> a
|
||||
let t_loop_left = forall2 "a" "b" @@ fun a b -> tuple2 (a --> sum a b) a --> b
|
||||
let t_neg = tuple1 int --> int
|
||||
let t_and = tuple2 bool bool --> bool
|
||||
let t_or = tuple2 bool bool --> bool
|
||||
@ -517,7 +515,6 @@ module Typer = struct
|
||||
| C_FAILWITH -> ok @@ t_failwith ;
|
||||
(* LOOPS *)
|
||||
| C_FOLD_WHILE -> ok @@ t_fold_while ;
|
||||
| C_LOOP_LEFT -> ok @@ t_loop_left;
|
||||
| C_FOLD_CONTINUE -> ok @@ t_continuation ;
|
||||
| C_FOLD_STOP -> ok @@ t_continuation ;
|
||||
(* MATH *)
|
||||
@ -1021,15 +1018,6 @@ module Typer = struct
|
||||
let%bind () = assert_eq_1 (t_pair (t_bool ()) init ()) result
|
||||
in ok init
|
||||
|
||||
let loop_left = typer_2 "LOOP_LEFT" @@ fun _body _init ->
|
||||
failwith ("should not be used before mini-c")
|
||||
(*
|
||||
let%bind (arg, result) = get_t_function body in
|
||||
let%bind () = assert_eq_1 arg init in
|
||||
let%bind () = assert_eq_1 arg result in (* Right now, only able to compile when both types are equals *)
|
||||
ok result
|
||||
*)
|
||||
|
||||
(* Continue and Stop are just syntactic sugar for building a pair (bool * a') *)
|
||||
let continue = typer_1 "CONTINUE" @@ fun arg ->
|
||||
ok @@ t_pair (t_bool ()) arg ()
|
||||
@ -1127,7 +1115,6 @@ module Typer = struct
|
||||
| C_FAILWITH -> ok @@ failwith_ ;
|
||||
(* LOOPS *)
|
||||
| C_FOLD_WHILE -> ok @@ fold_while ;
|
||||
| C_LOOP_LEFT -> ok @@ loop_left;
|
||||
| C_FOLD_CONTINUE -> ok @@ continue ;
|
||||
| C_FOLD_STOP -> ok @@ stop ;
|
||||
(* MATH *)
|
||||
|
@ -13,7 +13,6 @@ let reasonligo_sdata = {
|
||||
parser = Parser.Reasonligo.parse_expression }
|
||||
|
||||
let get_exp_as_string filename =
|
||||
Format.printf "Get file\n%!";
|
||||
let lines = ref [] in
|
||||
let chan = open_in filename in
|
||||
try
|
||||
@ -22,17 +21,11 @@ let get_exp_as_string filename =
|
||||
done; !lines
|
||||
with End_of_file ->
|
||||
close_in chan;
|
||||
Format.printf "End file\n%!";
|
||||
List.rev !lines ;;
|
||||
|
||||
let assert_syntax_error sdata () =
|
||||
Format.printf "ASsert\n%!";
|
||||
let n = ref 0 in
|
||||
let%bind _l = bind_iter_list
|
||||
(fun entry ->
|
||||
n := !n+1;
|
||||
Format.printf "Line %d : %s\n%!" !n entry;
|
||||
Assert.assert_fail @@ sdata.parser entry)
|
||||
(fun entry -> Assert.assert_fail @@ sdata.parser entry)
|
||||
(get_exp_as_string sdata.erroneous_source_file) in
|
||||
ok ()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user