Browse Source

quick pattern matcher fix before the end of the year

Simon Krajewski 12 years ago
parent
commit
009d8295e8
1 changed files with 4 additions and 1 deletions
  1. 4 1
      matcher.ml

+ 4 - 1
matcher.ml

@@ -742,10 +742,13 @@ let rec to_typed_ast mctx need_val dt =
 		error "Not implemented yet" Ast.null_pos
 	| Bind(out,dt) ->
 		replace_locals mctx out begin match out.o_guard,dt with
-			| _,None -> out.o_expr
+			| Some eg,None ->
+				mk (TIf(eg,out.o_expr,None)) t_dynamic out.o_expr.epos
 			| Some eg,Some dt ->
 				let eelse = to_typed_ast mctx need_val dt in
 				mk (TIf(eg,out.o_expr,Some eelse)) eelse.etype (punion out.o_expr.epos eelse.epos)
+			| _,None ->
+				out.o_expr
 			| _ -> assert false
 		end
 	| Switch(st,cases) ->