remove E_skip from core
This commit is contained in:
parent
5a4c0b32fb
commit
cb1bc95d59
@ -85,7 +85,7 @@ let rec compile_expression : I.expression -> O.expression result =
|
||||
let%bind rhs = compile_expression rhs in
|
||||
let%bind let_result = compile_expression let_result in
|
||||
return @@ O.E_let_in {let_binder=(binder,ty_opt);inline;rhs;let_result}
|
||||
| I.E_skip -> return @@ O.E_skip
|
||||
| I.E_skip -> ok @@ O.e_unit ~loc:e.location ()
|
||||
| I.E_constructor {constructor;element} ->
|
||||
let%bind element = compile_expression element in
|
||||
return @@ O.E_constructor {constructor;element}
|
||||
@ -270,7 +270,6 @@ let rec uncompile_expression : O.expression -> I.expression result =
|
||||
let%bind rhs = uncompile_expression rhs in
|
||||
let%bind let_result = uncompile_expression let_result in
|
||||
return @@ I.E_let_in {let_binder=(binder,ty_opt);inline;rhs;let_result}
|
||||
| O.E_skip -> return @@ I.E_skip
|
||||
| O.E_constructor {constructor;element} ->
|
||||
let%bind element = uncompile_expression element in
|
||||
return @@ I.E_constructor {constructor;element}
|
||||
|
@ -446,10 +446,6 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_expression -
|
||||
| E_literal (Literal_void) -> (
|
||||
failwith "TODO: missing implementation for literal void"
|
||||
)
|
||||
| E_skip -> (
|
||||
(* E_skip just returns unit *)
|
||||
return_wrapped (e_unit ()) state @@ Wrap.literal (t_unit ())
|
||||
)
|
||||
(* | E_literal (Literal_string s) -> (
|
||||
* L.log (Format.asprintf "literal_string option type: %a" PP_helpers.(option O.PP.type_expression) tv_opt) ;
|
||||
* match Option.map Ast_typed.get_type' tv_opt with
|
||||
|
@ -423,7 +423,7 @@ and type_expression' : environment -> ?tv_opt:O.type_expression -> I.expression
|
||||
return (E_variable name) tv'.type_value
|
||||
| E_literal (Literal_bool b) ->
|
||||
return (E_literal (Literal_bool b)) (t_bool ())
|
||||
| E_literal Literal_unit | E_skip ->
|
||||
| E_literal Literal_unit ->
|
||||
return (E_literal (Literal_unit)) (t_unit ())
|
||||
| E_literal Literal_void -> return (E_literal (Literal_void)) (t_unit ()) (* TODO : IS this really a t_unit ?*)
|
||||
| E_literal (Literal_string s) ->
|
||||
|
@ -58,8 +58,6 @@ and expression_content ppf (ec : expression_content) =
|
||||
cases
|
||||
| E_let_in { let_binder ;rhs ; let_result; inline } ->
|
||||
fprintf ppf "let %a = %a%a in %a" option_type_name let_binder expression rhs option_inline inline expression let_result
|
||||
| E_skip ->
|
||||
fprintf ppf "skip"
|
||||
| E_ascription {anno_expr; type_annotation} ->
|
||||
fprintf ppf "%a : %a" expression anno_expr type_expression
|
||||
type_annotation
|
||||
|
@ -121,7 +121,6 @@ let e_matching_bool ?loc a b c : expression = e_matching ?loc a (Match_bool {mat
|
||||
let e_accessor ?loc a b = make_expr ?loc @@ E_record_accessor {expr = a; label= Label b}
|
||||
let e_accessor_list ?loc a b = List.fold_left (fun a b -> e_accessor ?loc a b) a b
|
||||
let e_variable ?loc v = make_expr ?loc @@ E_variable v
|
||||
let e_skip ?loc () = make_expr ?loc @@ E_skip
|
||||
let e_let_in ?loc (binder, ascr) inline rhs let_result =
|
||||
make_expr ?loc @@ E_let_in { let_binder = (binder,ascr) ; rhs ; let_result; inline }
|
||||
let e_annotation ?loc anno_expr ty = make_expr ?loc @@ E_ascription {anno_expr; type_annotation = ty}
|
||||
|
@ -83,7 +83,6 @@ val e_matching_bool : ?loc:Location.t -> expression -> expression -> expression
|
||||
val e_accessor : ?loc:Location.t -> expression -> string -> expression
|
||||
val e_accessor_list : ?loc:Location.t -> expression -> string list -> expression
|
||||
val e_variable : ?loc:Location.t -> expression_variable -> expression
|
||||
val e_skip : ?loc:Location.t -> unit -> expression
|
||||
val e_sequence : ?loc:Location.t -> expression -> expression -> expression
|
||||
val e_cond: ?loc:Location.t -> expression -> expression -> expression -> expression
|
||||
val e_let_in : ?loc:Location.t -> ( expression_variable * type_expression option ) -> bool -> expression -> expression -> expression
|
||||
|
@ -184,7 +184,7 @@ let rec assert_value_eq (a, b: (expression * expression )) : unit result =
|
||||
| (E_application _, _) | (E_let_in _, _)
|
||||
| (E_recursive _,_) | (E_record_accessor _, _)
|
||||
| (E_look_up _, _) | (E_matching _, _)
|
||||
| (E_skip, _) -> simple_fail "comparing not a value"
|
||||
-> simple_fail "comparing not a value"
|
||||
|
||||
let is_value_eq (a , b) = to_bool @@ assert_value_eq (a , b)
|
||||
|
||||
|
@ -36,7 +36,6 @@ and expression_content =
|
||||
| E_lambda of lambda
|
||||
| E_recursive of recursive
|
||||
| E_let_in of let_in
|
||||
| E_skip
|
||||
(* Variant *)
|
||||
| E_constructor of constructor (* For user defined constructors *)
|
||||
| E_matching of matching
|
||||
|
@ -40,8 +40,8 @@ and expression_content =
|
||||
| E_variable of expression_variable
|
||||
| E_application of application
|
||||
| E_lambda of lambda
|
||||
| E_let_in of let_in
|
||||
| E_recursive of recursive
|
||||
| E_let_in of let_in
|
||||
(* Variant *)
|
||||
| E_constructor of constructor (* For user defined constructors *)
|
||||
| E_matching of matching
|
||||
|
Loading…
Reference in New Issue
Block a user