Prechádzať zdrojové kódy

better unify stack for TSign

Nicolas Cannasse 19 rokov pred
rodič
commit
304b84d715
1 zmenil súbory, kde vykonal 8 pridanie a 2 odobranie
  1. 8 2
      type.ml

+ 8 - 2
type.ml

@@ -406,9 +406,15 @@ let rec unify a b =
 		| None -> if not (link t b a) then error [cannot_unify a b]
 		| Some t -> unify a t)
 	| TSign (s,tl) , _ ->
-		unify (apply_params s.s_types tl s.s_type) b
+		(try 
+			unify (apply_params s.s_types tl s.s_type) b
+		with 
+			Unify_error l -> error (cannot_unify a b :: l))
 	| _ , TSign (s,tl) ->
-		unify a (apply_params s.s_types tl s.s_type)
+		(try 
+			unify a (apply_params s.s_types tl s.s_type)
+		with 
+			Unify_error l -> error (cannot_unify a b :: l))	
 	| TEnum (ea,tl1) , TEnum (eb,tl2) -> 
 		if ea != eb then error [cannot_unify a b];
 		unify_types a b tl1 tl2