|
@@ -247,8 +247,8 @@ and tabstract = {
|
|
|
|
|
|
mutable a_impl : tclass option;
|
|
|
mutable a_this : t;
|
|
|
- mutable a_from : t list;
|
|
|
- mutable a_to : t list;
|
|
|
+ mutable a_from : (t * tclass_field option) list;
|
|
|
+ mutable a_to : (t * tclass_field option) list;
|
|
|
}
|
|
|
|
|
|
and module_type =
|
|
@@ -993,11 +993,13 @@ let rec unify a b =
|
|
|
| _ , TAbstract ({a_path=[],"Void"},_) ->
|
|
|
error [cannot_unify a b]
|
|
|
| TAbstract (a1,tl1) , TAbstract (a2,tl2) ->
|
|
|
- if not (List.exists (fun t ->
|
|
|
+ if not (List.exists (fun (t,cfo) ->
|
|
|
let t = apply_params a1.a_types tl1 t in
|
|
|
+ let t = match cfo with None -> t | Some cf -> monomorphs cf.cf_params t in
|
|
|
try unify t b; true with Unify_error _ -> false
|
|
|
- ) a1.a_to) && not (List.exists (fun t ->
|
|
|
+ ) a1.a_to) && not (List.exists (fun (t,cfo) ->
|
|
|
let t = apply_params a2.a_types tl2 t in
|
|
|
+ let t = match cfo with None -> t | Some cf -> monomorphs cf.cf_params t in
|
|
|
try unify a t; true with Unify_error _ -> false
|
|
|
) a2.a_from) then error [cannot_unify a b]
|
|
|
| TInst (c1,tl1) , TInst (c2,tl2) ->
|
|
@@ -1143,8 +1145,9 @@ let rec unify a b =
|
|
|
| _ ->
|
|
|
error [cannot_unify a b])
|
|
|
| TAbstract (aa,tl), _ ->
|
|
|
- if not (List.exists (fun t ->
|
|
|
+ if not (List.exists (fun (t,cfo) ->
|
|
|
let t = apply_params aa.a_types tl t in
|
|
|
+ let t = match cfo with None -> t | Some cf -> monomorphs cf.cf_params t in
|
|
|
try unify t b; true with Unify_error _ -> false
|
|
|
) aa.a_to) then error [cannot_unify a b];
|
|
|
| TInst ({ cl_kind = KTypeParameter ctl } as c,pl), TAbstract _ ->
|
|
@@ -1154,8 +1157,9 @@ let rec unify a b =
|
|
|
try unify t b; true with Unify_error _ -> false
|
|
|
) ctl) then error [cannot_unify a b];
|
|
|
| _, TAbstract (bb,tl) ->
|
|
|
- if not (List.exists (fun t ->
|
|
|
+ if not (List.exists (fun (t,cfo) ->
|
|
|
let t = apply_params bb.a_types tl t in
|
|
|
+ let t = match cfo with None -> t | Some cf -> monomorphs cf.cf_params t in
|
|
|
try unify a t; true with Unify_error _ -> false
|
|
|
) bb.a_from) then error [cannot_unify a b];
|
|
|
| _ , _ ->
|