Help OCaml's type inference

Needed because of constructor name confusion
This commit is contained in:
Denis Merigoux 2022-07-14 15:29:50 +02:00
parent 29f9dfe055
commit 05115c7541
No known key found for this signature in database
GPG Key ID: EE99DCFA365C3EE3

View File

@ -321,11 +321,12 @@ let rec format_expr
Format.fprintf fmt "%a.%a" format_with_parens e1 format_struct_field_name
(Some s, fst (List.nth (find_struct s ctx) n)))
| EInj (e, n, en, _ts) ->
Format.fprintf fmt "@[<hov 2>%a@ %a@]" format_enum_cons_name
Format.fprintf fmt "@[<hov 2>(%a@ %a:@ %a)@]" format_enum_cons_name
(fst (List.nth (find_enum en ctx) n))
format_with_parens e
format_with_parens e format_enum_name en
| EMatch (e, es, e_name) ->
Format.fprintf fmt "@[<hov 2>match@ %a@]@ with@\n%a" format_with_parens e
Format.fprintf fmt "@[<hov 2>match@ (%a:@ %a)@]@ with@\n%a"
format_with_parens e format_enum_name e_name
(Format.pp_print_list
~pp_sep:(fun fmt () -> Format.fprintf fmt "@\n| ")
(fun fmt (e, c) ->