Browse Source

clean constraints once the monomorph is bound

Simon Krajewski 5 years ago
parent
commit
8a15c62ab8
1 changed files with 3 additions and 2 deletions
  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