瀏覽代碼

fixed bug.

Nicolas Cannasse 18 年之前
父節點
當前提交
afb5f61f6f
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      typer.ml

+ 5 - 3
typer.ml

@@ -1401,15 +1401,17 @@ and type_switch ctx e cases def need_val p =
 		let matchs (el,e) =
 			match el with
 			| CMatch (c,params) :: l ->
+				let params = ref params in
 				let cl = List.map (fun c ->
 					match c with
 					| CMatch (c,p) ->
-						if not (same_params p params) then display_error ctx "Constructors parameters differs : should be same name, same type, and same position" e.epos;
+						if not (same_params p !params) then display_error ctx "Constructors parameters differs : should be same name, same type, and same position" e.epos;
+						if p <> None then params := p;
 						c
 					| _ -> assert false
 				) l in
-				if params <> None then has_params := true;
-				(c :: cl) , params, e
+				if !params <> None then has_params := true;
+				(c :: cl) , !params, e
 			| _ ->
 				assert false
 		in