Browse Source

add missing recursion in `promote_complex_rhs` (closes #3732)

Simon Krajewski 10 years ago
parent
commit
682a4e2942
2 changed files with 11 additions and 0 deletions
  1. 1 0
      filters.ml
  2. 10 0
      tests/unit/src/unit/issues/Issue3732.hx

+ 1 - 0
filters.ml

@@ -81,6 +81,7 @@ let promote_complex_rhs com e =
 			| TVar(v,eo) ->
 			| TVar(v,eo) ->
 				begin match eo with
 				begin match eo with
 					| Some e when is_complex e ->
 					| Some e when is_complex e ->
+						let e = find e in
 						r := (loop (fun e -> mk (TBinop(OpAssign,mk (TLocal v) v.v_type e.epos,e)) v.v_type e.epos) e)
 						r := (loop (fun e -> mk (TBinop(OpAssign,mk (TLocal v) v.v_type e.epos,e)) v.v_type e.epos) e)
 							:: ((mk (TVar (v,None)) com.basic.tvoid e.epos))
 							:: ((mk (TVar (v,None)) com.basic.tvoid e.epos))
 							:: !r
 							:: !r

+ 10 - 0
tests/unit/src/unit/issues/Issue3732.hx

@@ -0,0 +1,10 @@
+package unit.issues;
+
+class Issue3732 extends Test {
+	function test() {
+		var a;
+        var b = a = try 1 catch (_:Dynamic) 2;
+		eq(1, a);
+		eq(1, b);
+	}
+}