Skip to content

Commit 3b7c521

Browse files
committed
More detailed error message
1 parent 88bbc95 commit 3b7c521

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

middle_end/flambda2/simplify/continuation_extra_params_and_args.ml

+22-6
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,34 @@ let add t ~invalids ~extra_param ~extra_args =
9595
let extra_params = Bound_parameters.cons extra_param extra_params in
9696
let extra_args =
9797
Apply_cont_rewrite_id.Map.merge
98-
(fun id already_extra_args extra_args ->
99-
match already_extra_args, extra_args with
98+
(fun id already_extra_args extra_arg ->
99+
match already_extra_args, extra_arg with
100100
| None, None -> None
101101
| None, Some _ ->
102-
Misc.fatal_errorf "Cannot change domain: %a"
103-
Apply_cont_rewrite_id.print id
102+
Misc.fatal_errorf
103+
"[Extra Params and Args] Unexpected New Apply_cont_rewrite_id \
104+
(%a) for:\n\
105+
new param: %a\n\
106+
new args: %a\n\
107+
new invalids: %a\n\
108+
existing epa: %a" Apply_cont_rewrite_id.print id
109+
Bound_parameter.print extra_param
110+
(Apply_cont_rewrite_id.Map.print Extra_arg.print)
111+
extra_args Apply_cont_rewrite_id.Set.print invalids print t
104112
| Some _, None ->
105113
if Apply_cont_rewrite_id.Set.mem id invalids
106114
then Some Or_invalid.Invalid
107115
else
108-
Misc.fatal_errorf "Cannot change domain: %a"
109-
Apply_cont_rewrite_id.print id
116+
Misc.fatal_errorf
117+
"[Extra Params and Args] Existing Apply_cont_rewrite_id (%a) \
118+
missing for:\n\
119+
new param: %a\n\
120+
new args: %a\n\
121+
new invalids: %a\n\
122+
existing epa: %a" Apply_cont_rewrite_id.print id
123+
Bound_parameter.print extra_param
124+
(Apply_cont_rewrite_id.Map.print Extra_arg.print)
125+
extra_args Apply_cont_rewrite_id.Set.print invalids print t
110126
| Some Or_invalid.Invalid, Some _ -> Some Or_invalid.Invalid
111127
| Some (Or_invalid.Ok already_extra_args), Some extra_arg ->
112128
Some (Or_invalid.Ok (extra_arg :: already_extra_args)))

middle_end/flambda2/simplify/env/continuation_uses.ml

+3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ type arg_at_use =
7676

7777
type arg_types_by_use_id = arg_at_use Apply_cont_rewrite_id.Map.t list
7878

79+
let print_arg_type_at_use ppf { arg_type; typing_env = _ } =
80+
Flambda2_types.print ppf arg_type
81+
7982
let add_value_to_arg_map arg_map arg_type ~use =
8083
let env_at_use = U.env_at_use use in
8184
let typing_env = DE.typing_env env_at_use in

middle_end/flambda2/simplify/env/continuation_uses.mli

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ type arg_at_use = private
4242

4343
type arg_types_by_use_id = arg_at_use Apply_cont_rewrite_id.Map.t list
4444

45+
val print_arg_type_at_use : Format.formatter -> arg_at_use -> unit
46+
4547
val get_arg_types_by_use_id : t -> arg_types_by_use_id
4648

4749
(* When we want to get the arg_types_by_use_id of the invariant params of a

0 commit comments

Comments
 (0)