소스 검색

clean constraints once the monomorph is bound

Simon Krajewski 5 년 전
부모
커밋
8a15c62ab8
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      src/core/tUnification.ml

+ 3 - 2
src/core/tUnification.ml

@@ -119,7 +119,8 @@ module Monomorph = struct
 
 	let do_bind m t =
 		(* assert(m.tm_type = None); *) (* TODO: should be here, but matcher.ml does some weird bind handling at the moment. *)
-		m.tm_type <- Some t
+		m.tm_type <- Some t;
+		m.tm_constraints <- []
 
 	let rec bind m t =
 		begin match t with
@@ -136,8 +137,8 @@ module Monomorph = struct
 		| TMono m2 ->
 			begin match m2.tm_type with
 			| None ->
+				List.iter (fun constr -> m2.tm_constraints <- constr :: m2.tm_constraints) m.tm_constraints;
 				do_bind m t;
-				List.iter (fun constr -> m2.tm_constraints <- constr :: m2.tm_constraints) m.tm_constraints
 			| Some t ->
 				bind m t
 			end