Browse Source

fix confusing match syntax

Simon Krajewski 3 months ago
parent
commit
f2bf4406fa
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/typing/typeloadCheck.ml

+ 4 - 3
src/typing/typeloadCheck.ml

@@ -65,10 +65,10 @@ let valid_redefinition map1 map2 f1 t1 f2 t2 = (* child, parent *)
 	begin match f1.cf_kind,f2.cf_kind with
 	begin match f1.cf_kind,f2.cf_kind with
 	| Method m1, Method m2 when not (m1 = MethDynamic) && not (m2 = MethDynamic) ->
 	| Method m1, Method m2 when not (m1 = MethDynamic) && not (m2 = MethDynamic) ->
 		begin match follow t1, follow t2 with
 		begin match follow t1, follow t2 with
-		| TFun (args1,r1) , TFun (args2,r2) -> (
+		| TFun (args1,r1) , TFun (args2,r2) ->
 			if not (List.length args1 = List.length args2) then raise (Unify_error [Unify_custom "Different number of function arguments"]);
 			if not (List.length args1 = List.length args2) then raise (Unify_error [Unify_custom "Different number of function arguments"]);
 			let i = ref 0 in
 			let i = ref 0 in
-			try
+			begin try
 				valid r1 r2;
 				valid r1 r2;
 				List.iter2 (fun (n,o1,a1) (_,o2,a2) ->
 				List.iter2 (fun (n,o1,a1) (_,o2,a2) ->
 					incr i;
 					incr i;
@@ -77,7 +77,8 @@ let valid_redefinition map1 map2 f1 t1 f2 t2 = (* child, parent *)
 				) args1 args2;
 				) args1 args2;
 			with Unify_error l ->
 			with Unify_error l ->
 				let msg = if !i = 0 then Invalid_return_type else Invalid_function_argument(!i,List.length args1) in
 				let msg = if !i = 0 then Invalid_return_type else Invalid_function_argument(!i,List.length args1) in
-				raise (Unify_error (Cannot_unify (t1,t2) :: msg :: l)))
+				raise (Unify_error (Cannot_unify (t1,t2) :: msg :: l))
+			end
 		| _ ->
 		| _ ->
 			die "" __LOC__
 			die "" __LOC__
 		end
 		end