Browse Source

bugfix : prevent recursive anonymous objects.

Nicolas Cannasse 18 years ago
parent
commit
0dacb1c279
2 changed files with 5 additions and 0 deletions
  1. 2 0
      doc/CHANGES.txt
  2. 3 0
      type.ml

+ 2 - 0
doc/CHANGES.txt

@@ -5,6 +5,8 @@
 	display error position in front of each error line
 	display error position in front of each error line
 	improved error messages when optional arguments not matched
 	improved error messages when optional arguments not matched
 	added neko.io.Path
 	added neko.io.Path
+	added neko.net.ProxyDetect
+	bugfix in unify : prevent recursive anonymous objects
 
 
 2007-01-01: 1.10
 2007-01-01: 1.10
 	fix in haxe.remoting.SocketConnection.readAnswer
 	fix in haxe.remoting.SocketConnection.readAnswer

+ 3 - 0
type.ml

@@ -459,11 +459,13 @@ let rec type_eq param a b =
 				with
 				with
 					Not_found ->
 					Not_found ->
 						if is_closed a2 then raise Exit;
 						if is_closed a2 then raise Exit;
+						if not (link (ref None) b f1.cf_type) then raise Exit;
 						a2.a_fields <- PMap.add f1.cf_name f1 a2.a_fields
 						a2.a_fields <- PMap.add f1.cf_name f1 a2.a_fields
 			) a1.a_fields;
 			) a1.a_fields;
 			PMap.iter (fun _ f2 ->
 			PMap.iter (fun _ f2 ->
 				if not (PMap.mem f2.cf_name a1.a_fields) then begin
 				if not (PMap.mem f2.cf_name a1.a_fields) then begin
 					if is_closed a1 then raise Exit;
 					if is_closed a1 then raise Exit;
+					if not (link (ref None) a f2.cf_type) then raise Exit;
 					a1.a_fields <- PMap.add f2.cf_name f2 a1.a_fields
 					a1.a_fields <- PMap.add f2.cf_name f2 a1.a_fields
 				end;
 				end;
 			) a2.a_fields;
 			) a2.a_fields;
@@ -622,6 +624,7 @@ let rec unify a b =
 			with
 			with
 				Not_found ->
 				Not_found ->
 					if is_closed a1 then error [has_no_field a n];
 					if is_closed a1 then error [has_no_field a n];
+					if not (link (ref None) a f2.cf_type) then error [cannot_unify a b];
 					a1.a_fields <- PMap.add n f2 a1.a_fields
 					a1.a_fields <- PMap.add n f2 a1.a_fields
 			) a2.a_fields;
 			) a2.a_fields;
 			if !(a1.a_status) = Opened then a1.a_status := Closed;
 			if !(a1.a_status) = Opened then a1.a_status := Closed;