parent
83e3d1b917
commit
5cddcf7363
|
@ -1437,6 +1437,19 @@ let explanation unif t3 t4 ppf =
|
|||
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 =
|
||||
match mis with
|
||||
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
|
||||
| _ -> ()
|
||||
|
||||
let unification_error unif tr txt1 ppf txt2 =
|
||||
let unification_error env unif tr txt1 ppf txt2 =
|
||||
reset ();
|
||||
trace_same_names tr;
|
||||
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'
|
||||
(trace false "is not compatible with type") tr
|
||||
(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
|
||||
with exn ->
|
||||
print_labels := true;
|
||||
|
@ -1497,7 +1515,7 @@ let unification_error unif tr txt1 ppf txt2 =
|
|||
|
||||
let report_unification_error ppf env ?(unif=true)
|
||||
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 =
|
||||
|
|
Loading…
Reference in New Issue