Browse Source

another type parameter hole : use locked classes.

Nicolas Cannasse 19 years ago
parent
commit
5c6c00b910
2 changed files with 4 additions and 1 deletions
  1. 3 1
      type.ml
  2. 1 0
      typer.ml

+ 3 - 1
type.ml

@@ -93,6 +93,7 @@ and tclass = {
 	cl_private : bool;
 	mutable cl_extern : bool;
 	mutable cl_interface : bool;
+	mutable cl_locked : bool;
 	mutable cl_types : (string * t) list;
 	mutable cl_super : (tclass * t list) option;
 	mutable cl_implements : (tclass * t list) list;
@@ -142,6 +143,7 @@ let mk_class path pos doc priv =
 		cl_private = priv;
 		cl_extern = false;
 		cl_interface = false;
+		cl_locked = false;
 		cl_types = [];
 		cl_super = None;
 		cl_implements = [];
@@ -374,7 +376,7 @@ let rec unify a b =
 		in
 		(try
 			loop c tl;
-			true
+			not c.cl_locked
 		with
 			Not_found -> false)
 	| TAnon (fl1,_) , TAnon (fl2,_) ->

+ 1 - 0
typer.ml

@@ -267,6 +267,7 @@ let type_type_params ctx path p (n,flags) =
 	| l ->
 		(* build a phantom class *)
 		let c = mk_class (fst path @ [snd path],n) p None true in
+		c.cl_locked <- true;
 		set_heritance ctx c (List.map (fun t -> HImplements t) l) p;
 		let add_field ctypes params _ f =
 			let f = { f with cf_type = apply_params ctypes params f.cf_type } in