Parcourir la source

[matcher] fix exhaustiveness under null-guard

Simon Krajewski il y a 7 ans
Parent
commit
f9f38589ed
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      src/typing/matcher.ml

+ 3 - 1
src/typing/matcher.ml

@@ -635,6 +635,8 @@ module Decision_tree = struct
 		| Fail ->
 			"<fail>"
 
+	let to_string tabs dt = Printf.sprintf "%2i %s" dt.dt_i (to_string tabs dt)
+
 	let equal_dt dt1 dt2 = dt1.dt_i = dt2.dt_i
 
 	let equal dt1 dt2 = match dt1,dt2 with
@@ -1460,7 +1462,7 @@ module TexprConverter = struct
 								mk (TIf(e_cond,e_then,Some e_else)) t_switch (punion e_then.epos e_else.epos)
 							)
 						with Not_exhaustive ->
-							if toplevel then (fun () -> loop false params dt2)
+							if toplevel then (fun () -> loop toplevel params dt2)
 							else if ctx.com.display.DisplayMode.dms_error_policy = DisplayMode.EPIgnore then (fun () -> mk (TConst TNull) (mk_mono()) dt2.dt_pos)
 							else report_not_exhaustive e [(ConConst TNull,dt.dt_pos),dt.dt_pos]
 						in