parent
83e3d1b917
commit
5cddcf7363
|
@ -1437,6 +1437,19 @@ let explanation unif t3 t4 ppf =
|
||||||
end
|
end
|
||||||
| _ -> ()
|
| _ -> ()
|
||||||
|
|
||||||
|
|
||||||
|
let warn_on_missing_def env ppf t =
|
||||||
|
match t.desc with
|
||||||
|
| Tconstr (p,_,_) ->
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
ignore(Env.find_type p env : Types.type_declaration)
|
||||||
|
with Not_found ->
|
||||||
|
fprintf ppf
|
||||||
|
"@,@[%a is abstract because no corresponding cmi file was found in path.@]" path p
|
||||||
|
end
|
||||||
|
| _ -> ()
|
||||||
|
|
||||||
let explanation unif mis ppf =
|
let explanation unif mis ppf =
|
||||||
match mis with
|
match mis with
|
||||||
None -> ()
|
None -> ()
|
||||||
|
@ -1466,7 +1479,7 @@ let rec trace_same_names = function
|
||||||
type_same_name t1 t2; type_same_name t1' t2'; trace_same_names rem
|
type_same_name t1 t2; type_same_name t1' t2'; trace_same_names rem
|
||||||
| _ -> ()
|
| _ -> ()
|
||||||
|
|
||||||
let unification_error unif tr txt1 ppf txt2 =
|
let unification_error env unif tr txt1 ppf txt2 =
|
||||||
reset ();
|
reset ();
|
||||||
trace_same_names tr;
|
trace_same_names tr;
|
||||||
let tr = List.map (fun (t, t') -> (t, hide_variant_name t')) tr in
|
let tr = List.map (fun (t, t') -> (t, hide_variant_name t')) tr in
|
||||||
|
@ -1490,6 +1503,11 @@ let unification_error unif tr txt1 ppf txt2 =
|
||||||
txt2 (type_expansion t2) t2'
|
txt2 (type_expansion t2) t2'
|
||||||
(trace false "is not compatible with type") tr
|
(trace false "is not compatible with type") tr
|
||||||
(explanation unif mis);
|
(explanation unif mis);
|
||||||
|
if env <> Env.empty
|
||||||
|
then begin
|
||||||
|
warn_on_missing_def env ppf t1;
|
||||||
|
warn_on_missing_def env ppf t2
|
||||||
|
end;
|
||||||
print_labels := true
|
print_labels := true
|
||||||
with exn ->
|
with exn ->
|
||||||
print_labels := true;
|
print_labels := true;
|
||||||
|
@ -1497,7 +1515,7 @@ let unification_error unif tr txt1 ppf txt2 =
|
||||||
|
|
||||||
let report_unification_error ppf env ?(unif=true)
|
let report_unification_error ppf env ?(unif=true)
|
||||||
tr txt1 txt2 =
|
tr txt1 txt2 =
|
||||||
wrap_printing_env env (fun () -> unification_error unif tr txt1 ppf txt2)
|
wrap_printing_env env (fun () -> unification_error env unif tr txt1 ppf txt2)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
let trace fst keep_last txt ppf tr =
|
let trace fst keep_last txt ppf tr =
|
||||||
|
|
Loading…
Reference in New Issue