Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions jscomp/super_errors/super_typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,21 @@ let report_error env ppf = function
| Some (actual, expected) -> collect_missing_arguments actual expected
| None -> assert false
in
let print_arguments =
Format.pp_print_list
~pp_sep:(fun ppf _ -> fprintf ppf ",@ ")
(fun ppf (label, argtype) ->
if label = "" then fprintf ppf "@[%a@]" type_expr argtype
else fprintf ppf "@[(~%s: %a)@]" label type_expr argtype
)
in
match missing_arguments with
| Some [singleArgument] ->
fprintf ppf "@[@{<info>This call is missing a final argument@} of type@ %a@]"
print_arguments [singleArgument]
| Some arguments ->
fprintf ppf "You're missing arguments: @[%a@]" (Format.pp_print_list ~pp_sep:(fun ppf _ -> fprintf ppf ", ") (fun ppf (label, argtype) ->
if label = "" then type_expr ppf argtype
else fprintf ppf "~%s: %a" label type_expr argtype
)) arguments
fprintf ppf "@[<hv>@{<info>This call is missing final arguments@} of type:@ %a@]"
print_arguments arguments
| None ->
check_bs_arity_mismatch ppf trace;
super_report_unification_error ppf env trace
Expand Down