@@ -156,9 +156,11 @@ module DolmenIntf = struct
156156
157157 let to_ety (ty : DTy.t ) : Ty.t =
158158 match ty with
159- | { ty_descr = TyApp ({ builtin = DBuiltin. Int ; _ } , _ ); _ } -> Ty_int
160- | { ty_descr = TyApp ({ builtin = DBuiltin. Real ; _ } , _ ); _ } -> Ty_real
161- | { ty_descr = TyApp ({ builtin = DBuiltin. Prop ; _ } , _ ); _ } -> Ty_bool
159+ | { ty_descr = TyApp ({ builtin = DBuiltin. Int ; _ } , _ ); _ } -> Ty Ty_int
160+ | { ty_descr = TyApp ({ builtin = DBuiltin. Real ; _ } , _ ); _ } ->
161+ Ty Ty_real
162+ | { ty_descr = TyApp ({ builtin = DBuiltin. Prop ; _ } , _ ); _ } ->
163+ Ty Ty_bool
162164 | { ty_descr =
163165 TyApp
164166 ( { builtin = DBuiltin. Base
@@ -168,13 +170,13 @@ module DolmenIntf = struct
168170 , _ )
169171 ; _
170172 } ->
171- Ty_str
173+ Ty Ty_str
172174 | { ty_descr = TyApp ({ builtin = DBuiltin. Bitv n ; _ } , _ ); _ } ->
173- Ty_bitv n
175+ Ty ( Ty_bitv n)
174176 | { ty_descr = TyApp ({ builtin = DBuiltin. Float (8 , 24 ); _ } , _ ); _ } ->
175- Ty_fp 32
177+ Ty ( Ty_fp 32 )
176178 | { ty_descr = TyApp ({ builtin = DBuiltin. Float (11 , 53 ); _ } , _ ); _ } ->
177- Ty_fp 64
179+ Ty ( Ty_fp 64 )
178180 | _ -> Fmt. failwith {| Unsupported dolmen type " %a" | } DTy. print ty
179181 end
180182
@@ -352,23 +354,24 @@ end
352354
353355let tty_of_etype (e : Ty.t ) : DTy.t =
354356 match e with
355- | Ty_int -> DTy. int
356- | Ty_real -> DTy. real
357- | Ty_bool -> DTy. bool
358- | Ty_str -> Builtin. string_ty
359- | Ty_bitv 8 -> DTy. bitv 8
360- | Ty_bitv 32 -> DTy. bitv 32
361- | Ty_bitv 64 -> DTy. bitv 64
362- | Ty_fp 32 -> Builtin. float32_ty
363- | Ty_fp 64 -> Builtin. float64_ty
364- | Ty_fp _ | Ty_bitv _ | Ty_list | Ty_app | Ty_unit | Ty_none | Ty_regexp ->
357+ | Ty Ty_int -> DTy. int
358+ | Ty Ty_real -> DTy. real
359+ | Ty Ty_bool -> DTy. bool
360+ | Ty Ty_str -> Builtin. string_ty
361+ | Ty (Ty_bitv 8 ) -> DTy. bitv 8
362+ | Ty (Ty_bitv 32 ) -> DTy. bitv 32
363+ | Ty (Ty_bitv 64 ) -> DTy. bitv 64
364+ | Ty (Ty_fp 32 ) -> Builtin. float32_ty
365+ | Ty (Ty_fp 64 ) -> Builtin. float64_ty
366+ | Ty (Ty_fp _ | Ty_bitv _ | Ty_list | Ty_app | Ty_unit | Ty_none | Ty_regexp )
367+ ->
365368 Fmt. failwith {| Unsupported type " %a" | } Ty. pp e
366369
367370let tty_to_etype (ty : DTy.t ) : Ty.t =
368371 match ty with
369- | { ty_descr = TyApp ({ builtin = DBuiltin. Int ; _ } , _ ); _ } -> Ty_int
370- | { ty_descr = TyApp ({ builtin = DBuiltin. Real ; _ } , _ ); _ } -> Ty_real
371- | { ty_descr = TyApp ({ builtin = DBuiltin. Prop ; _ } , _ ); _ } -> Ty_bool
372+ | { ty_descr = TyApp ({ builtin = DBuiltin. Int ; _ } , _ ); _ } -> Ty Ty_int
373+ | { ty_descr = TyApp ({ builtin = DBuiltin. Real ; _ } , _ ); _ } -> Ty Ty_real
374+ | { ty_descr = TyApp ({ builtin = DBuiltin. Prop ; _ } , _ ); _ } -> Ty Ty_bool
372375 | { ty_descr =
373376 TyApp
374377 ( { builtin = DBuiltin. Base
@@ -378,12 +381,13 @@ let tty_to_etype (ty : DTy.t) : Ty.t =
378381 , _ )
379382 ; _
380383 } ->
381- Ty_str
382- | { ty_descr = TyApp ({ builtin = DBuiltin. Bitv n ; _ } , _ ); _ } -> Ty_bitv n
384+ Ty Ty_str
385+ | { ty_descr = TyApp ({ builtin = DBuiltin. Bitv n ; _ } , _ ); _ } ->
386+ Ty (Ty_bitv n)
383387 | { ty_descr = TyApp ({ builtin = DBuiltin. Float (8 , 24 ); _ } , _ ); _ } ->
384- Ty_fp 32
388+ Ty ( Ty_fp 32 )
385389 | { ty_descr = TyApp ({ builtin = DBuiltin. Float (11 , 53 ); _ } , _ ); _ } ->
386- Ty_fp 64
390+ Ty ( Ty_fp 64 )
387391 | _ -> Fmt. failwith {| Unsupported dolmen type " %a" | } DTy. print ty
388392
389393module SHT = Hashtbl. Make (struct
@@ -827,60 +831,60 @@ let encode_val : Value.t -> expr = function
827831 | Num (F64 x ) -> Fp. encode_val C64 x
828832 | v -> Fmt. failwith {| Unsupported value " %a" | } Value. pp v
829833
830- let encode_unop (ty : Ty.t ) =
834+ let encode_unop (Ty ty as ty_ : Ty.t ) =
831835 match ty with
832836 | Ty_int -> I. encode_unop
833837 | Ty_real -> Real. encode_unop
834838 | Ty_bool -> Boolean. encode_unop
835839 | Ty_str -> Str. encode_unop
836840 | Ty_bitv _ -> Bv. encode_unop
837841 | Ty_fp _ -> Fp. encode_unop
838- | (Ty_list | Ty_app | Ty_unit | Ty_none | Ty_regexp ) as op ->
839- Fmt. failwith {| Trying to encode unsupported op of type % a| } Ty. pp op
842+ | (Ty_list | Ty_app | Ty_unit | Ty_none | Ty_regexp ) ->
843+ Fmt. failwith {| Trying to encode unsupported op of type % a| } Ty. pp ty_
840844
841- let encode_binop (ty : Ty.t ) =
845+ let encode_binop (Ty ty as ty_ : Ty.t ) =
842846 match ty with
843847 | Ty_int -> I. encode_binop
844848 | Ty_real -> Real. encode_binop
845849 | Ty_bool -> Boolean. encode_binop
846850 | Ty_str -> Str. encode_binop
847851 | Ty_bitv _ -> Bv. encode_binop
848852 | Ty_fp _ -> Fp. encode_binop
849- | (Ty_list | Ty_app | Ty_unit | Ty_none | Ty_regexp ) as op ->
850- Fmt. failwith " Trying to encode unsupported op of type %a" Ty. pp op
853+ | (Ty_list | Ty_app | Ty_unit | Ty_none | Ty_regexp ) ->
854+ Fmt. failwith " Trying to encode unsupported op of type %a" Ty. pp ty_
851855
852- let encode_triop (ty : Ty.t ) =
856+ let encode_triop (Ty ty as ty_ : Ty.t ) =
853857 match ty with
854858 | Ty_int -> I. encode_triop
855859 | Ty_real -> Real. encode_triop
856860 | Ty_bool -> Boolean. encode_triop
857861 | Ty_str -> Str. encode_triop
858862 | Ty_bitv _ -> Bv. encode_triop
859863 | Ty_fp _ -> Fp. encode_triop
860- | (Ty_list | Ty_app | Ty_unit | Ty_none | Ty_regexp ) as op ->
861- Fmt. failwith " Trying to encode unsupported op of type %a" Ty. pp op
864+ | (Ty_list | Ty_app | Ty_unit | Ty_none | Ty_regexp ) ->
865+ Fmt. failwith " Trying to encode unsupported op of type %a" Ty. pp ty_
862866
863- let encode_relop (ty : Ty.t ) =
867+ let encode_relop (Ty ty as ty_ : Ty.t ) =
864868 match ty with
865869 | Ty_int -> I. encode_relop
866870 | Ty_real -> Real. encode_relop
867871 | Ty_bool -> Boolean. encode_relop
868872 | Ty_str -> Str. encode_relop
869873 | Ty_bitv _ -> Bv. encode_relop
870874 | Ty_fp _ -> Fp. encode_relop
871- | (Ty_list | Ty_app | Ty_unit | Ty_none | Ty_regexp ) as op ->
872- Fmt. failwith " Trying to encode unsupported op of type %a" Ty. pp op
875+ | (Ty_list | Ty_app | Ty_unit | Ty_none | Ty_regexp ) ->
876+ Fmt. failwith " Trying to encode unsupported op of type %a" Ty. pp ty_
873877
874- let encode_cvtop (ty : Ty.t ) =
878+ let encode_cvtop (Ty ty as ty_ : Ty.t ) =
875879 match ty with
876880 | Ty_int -> I. encode_cvtop
877881 | Ty_real -> Real. encode_cvtop
878882 | Ty_bool -> Boolean. encode_cvtop
879883 | Ty_str -> Str. encode_cvtop
880884 | Ty_bitv sz -> Bv. encode_cvtop sz
881885 | Ty_fp sz -> Fp. encode_cvtop sz
882- | (Ty_list | Ty_app | Ty_unit | Ty_none | Ty_regexp ) as op ->
883- Fmt. failwith " Trying to encode unsupported op of type %a" Ty. pp op
886+ | (Ty_list | Ty_app | Ty_unit | Ty_none | Ty_regexp ) ->
887+ Fmt. failwith " Trying to encode unsupported op of type %a" Ty. pp ty_
884888
885889let encode_expr_acc ?(record_sym = fun acc _ -> acc) acc e =
886890 let rec aux acc (e : Expr.t ) =
0 commit comments