|
@@ -330,7 +330,7 @@ let load_type_opt ?(opt=false) ctx p t =
|
|
|
|
|
|
let valid_redefinition ctx f1 t1 f2 t2 =
|
|
|
let valid t1 t2 =
|
|
|
- type_eq EqStrict t1 t2;
|
|
|
+ unify_raise ctx t1 t2 f2.cf_pos;
|
|
|
if is_null t1 <> is_null t2 then raise (Unify_error [Cannot_unify (t1,t2)]);
|
|
|
in
|
|
|
let t1, t2 = (match f1.cf_params, f2.cf_params with
|
|
@@ -344,12 +344,14 @@ let valid_redefinition ctx f1 t1 f2 t2 =
|
|
|
| TFun (args1,r1) , TFun (args2,r2) when List.length args1 = List.length args2 ->
|
|
|
List.iter2 (fun (n,o1,a1) (_,o2,a2) ->
|
|
|
if o1 <> o2 then raise (Unify_error [Not_matching_optional n]);
|
|
|
- valid a1 a2;
|
|
|
+ valid a2 a1;
|
|
|
) args1 args2;
|
|
|
+ unify_raise ctx r1 r2 f2.cf_pos;
|
|
|
valid r1 r2;
|
|
|
| _ , _ ->
|
|
|
(* in case args differs, or if an interface var *)
|
|
|
- valid t1 t2
|
|
|
+ type_eq EqStrict t1 t2;
|
|
|
+ if is_null t1 <> is_null t2 then raise (Unify_error [Cannot_unify (t1,t2)])
|
|
|
|
|
|
let copy_meta meta_src meta_target sl =
|
|
|
let meta = ref meta_target in
|