Browse Source

do not close Const anons in `unify_min` (see #3132)

Simon Krajewski 11 years ago
parent
commit
b88d312f9f
2 changed files with 10 additions and 1 deletions
  1. 10 0
      tests/unit/issues/Issue3132.hx
  2. 0 1
      typer.ml

+ 10 - 0
tests/unit/issues/Issue3132.hx

@@ -0,0 +1,10 @@
+package unit.issues;
+
+class Issue3132 extends unit.Test {
+	function test() {
+		var a:Array<{a:Int, ?b:Int}> = [{a:1}, {a:1, b:2}];
+		var a:Array<{a:Int, ?b:Int}> = [{a:1, b:2}, {a:1}];
+		//t(unit.TestType.typeError([{a:1}, {a:1, b:2}]));
+		//t(unit.TestType.typeError([{a:1, b:2}, {a:1}]));
+	}
+}

+ 0 - 1
typer.ml

@@ -611,7 +611,6 @@ let rec unify_min_raise ctx (el:texpr list) : t =
 			let fields = List.fold_left (fun acc e ->
 				match follow e.etype with
 				| TAnon a when !(a.a_status) = Const ->
-					a.a_status := Closed;
 					if !fcount = -1 then begin
 						fcount := field_count a;
 						PMap.map (fun f -> [expr f]) a.a_fields