Commit 006726b2 authored by Andrei Paskevich's avatar Andrei Paskevich

minor improvement of an error message

parent 54554c44
......@@ -506,8 +506,9 @@ let () = Exn_printer.register
| Ty.BadTypeArity ({ts_args = []} as ts, _) ->
fprintf fmt "Type symbol %a expects no arguments" print_ts ts
| Ty.BadTypeArity (ts, app_arg) ->
fprintf fmt "Type symbol %a expects %i arguments but is applied to %i"
print_ts ts (List.length ts.ts_args) app_arg
let i = List.length ts.ts_args in
fprintf fmt "Type symbol %a expects %i argument%s but is applied to %i"
print_ts ts i (if i = 1 then "" else "s") app_arg
| Ty.DuplicateTypeVar tv ->
fprintf fmt "Type variable %a is used twice" print_tv tv
| Ty.UnboundTypeVar tv ->
......@@ -518,9 +519,10 @@ let () = Exn_printer.register
fprintf fmt "%s %a expects no arguments"
(if ls.ls_value = None then "Predicate" else "Function") print_ls ls
| Term.BadArity (ls, app_arg) ->
fprintf fmt "%s %a expects %i arguments but is applied to %i"
let i = List.length ls.ls_args in
fprintf fmt "%s %a expects %i argument%s but is applied to %i"
(if ls.ls_value = None then "Predicate" else "Function")
print_ls ls (List.length ls.ls_args) app_arg
print_ls ls i (if i = 1 then "" else "s") app_arg
| Term.EmptyCase ->
fprintf fmt "Empty match expression"
| Term.DuplicateVar vs ->
......
......@@ -907,10 +907,11 @@ let () = Exn_printer.register
Format.fprintf fmt "Metaproperty %s is already registered with \
a conflicting signature" m.meta_name
| BadMetaArity (m,n) ->
Format.fprintf fmt "Metaproperty %s requires %d arguments but \
is applied to %d" m.meta_name (List.length m.meta_type) n
let i = List.length m.meta_type in
Format.fprintf fmt "Metaproperty %s expects %d argument%s but \
is applied to %d" m.meta_name i (if i = 1 then "" else "s") n
| MetaTypeMismatch (m,t1,t2) ->
Format.fprintf fmt "Metaproperty %s expects %a argument but \
Format.fprintf fmt "Metaproperty %s expects a %a argument but \
is applied to %a"
m.meta_name print_meta_arg_type t1 print_meta_arg_type t2
| _ -> raise exn
......
......@@ -432,12 +432,14 @@ let () = Exn_printer.register
| Mlw_ty.BadItyArity ({its_ts = {ts_args = []}} as ts, _) ->
fprintf fmt "Type symbol %a expects no arguments" print_its ts
| Mlw_ty.BadItyArity (ts, app_arg) ->
fprintf fmt "Type symbol %a expects %i arguments but is applied to %i"
print_its ts (List.length ts.its_ts.ts_args) app_arg
let i = List.length ts.its_ts.ts_args in
fprintf fmt "Type symbol %a expects %i argument%s but is applied to %i"
print_its ts i (if i = 1 then "" else "s") app_arg
| Mlw_ty.BadRegArity (ts, app_arg) ->
let i = List.length ts.its_regs in
fprintf fmt "Type symbol %a expects \
%i region arguments but is applied to %i"
print_its ts (List.length ts.its_regs) app_arg
%i region argument%s but is applied to %i"
print_its ts i (if i = 1 then "" else "s") app_arg
| Mlw_ty.DuplicateRegion r ->
fprintf fmt "Region %a is used twice" print_reg r
| Mlw_ty.UnboundRegion r ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment