Commit f3bcd139 authored by MARCHE Claude's avatar MARCHE Claude Committed by Guillaume Melquiond

fix ambiguous or patterns (warning 57)

parent 26f3c01c
......@@ -113,10 +113,8 @@ let to_elim el t = match el with
let vl,_,t = t_open_lambda t in
vl = [] || t.t_ty = None
let rec lift_f el acc t0 = match t0.t_node with
| (Tapp (ps, [t1; {t_node = Teps fb} as t2])
| Tapp (ps, [{t_node = Teps fb} as t2; t1]))
when ls_equal ps ps_equ && to_elim el t2 ->
let rec lift_f el acc t0 =
let elim_eps_eq t1 fb t2 =
let vs, f = t_open_bound fb in
if canonicalize vs f <> Nothing then
match t1.t_node with
......@@ -132,6 +130,15 @@ let rec lift_f el acc t0 = match t0.t_node with
else
let f = t_let_close_simp vs t1 f in
lift_f el acc (t_label_copy t0 f)
in
match t0.t_node with
(* cannot merge the 2 patterns because of warning 57 *)
| Tapp (ps, [t1; {t_node = Teps fb} as t2])
when ls_equal ps ps_equ && to_elim el t2 ->
elim_eps_eq t1 fb t2
| Tapp (ps, [{t_node = Teps fb} as t2; t1])
when ls_equal ps ps_equ && to_elim el t2 ->
elim_eps_eq t1 fb t2
| Teps fb when to_elim el t0 ->
let vl = Mvs.keys (t_vars t0) in
let vs, f = t_open_bound fb in
......
......@@ -115,12 +115,18 @@ let dive_to_constructor kn fn env t =
let rec cs_equ kn env t1 t2 =
if t_equal t1 t2 then t_true
else match t1,t2 with
else
let aux cs tl t =
let fn = apply_cs_equ kn cs tl in
try dive_to_constructor kn fn env t
with Exit -> t_equ t1 t2
in
match t1,t2 with
(* cannot merge the 2 patterns because of warning 57 *)
| { t_node = Tapp (cs,tl) }, t
| t, { t_node = Tapp (cs,tl) } when is_constructor kn cs ->
let fn = apply_cs_equ kn cs tl in
begin try dive_to_constructor kn fn env t
with Exit -> t_equ t1 t2 end
when is_constructor kn cs -> aux cs tl t
| t, { t_node = Tapp (cs,tl) }
when is_constructor kn cs -> aux cs tl t
| _ -> t_equ t1 t2
and apply_cs_equ kn cs1 tl1 env t = match t.t_node with
......
......@@ -782,14 +782,14 @@ module Print = struct
fprintf fmt "%s" s
else
let fname = if lp = [] then info.fname else None in
let m = String.capitalize (modulename ?fname lp t) in
let m = Strings.capitalize (modulename ?fname lp t) in
fprintf fmt "%s.%s" m s
with Not_found ->
let s = id_unique ~sanitizer iprinter id in
fprintf fmt "%s" s
let print_lident = print_qident ~sanitizer:String.uncapitalize
let print_uident = print_qident ~sanitizer:String.capitalize
let print_lident = print_qident ~sanitizer:Strings.uncapitalize
let print_uident = print_qident ~sanitizer:Strings.capitalize
let print_path_id fmt = function
| [], id -> print_ident fmt id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment