Skip to content

Commit 1393a49

Browse files
bgregoirstrub
authored andcommitted
fix bug #765
1 parent 7259c58 commit 1393a49

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/ecReduction.ml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ module EqTest_base = struct
120120
| _, _ -> raise E.NotConv in
121121

122122
let rec aux alpha e1 e2 =
123-
e_equal e1 e2 || aux_r alpha e1 e2
123+
(* If alpha is not empty then the test e_equal can be wrong *)
124+
(e_equal e1 e2 && Mid.is_empty alpha)
125+
|| aux_r alpha e1 e2
124126

125127
and aux_r alpha e1 e2 =
126128
match e1.e_node, e2.e_node with
@@ -138,14 +140,14 @@ module EqTest_base = struct
138140

139141
| Equant(q1,b1,e1), Equant(q2,b2,e2) when eqt_equal q1 q2 ->
140142
let alpha = check_bindings env alpha b1 b2 in
141-
noconv (aux alpha) e1 e2
143+
aux alpha e1 e2
142144

143145
| Eapp (f1, args1), Eapp (f2, args2) ->
144146
aux alpha f1 f2 && List.all2 (aux alpha) args1 args2
145147

146148
| Elet (p1, f1', g1), Elet (p2, f2', g2) ->
147149
aux alpha f1' f2'
148-
&& noconv (aux (check_lpattern alpha p1 p2)) g1 g2
150+
&& aux (check_lpattern alpha p1 p2) g1 g2
149151

150152
| Etuple args1, Etuple args2 -> List.all2 (aux alpha) args1 args2
151153

@@ -156,9 +158,12 @@ module EqTest_base = struct
156158
for_type env ty1 ty2
157159
&& List.all2 (aux alpha) (e1::es1) (e2::es2)
158160

161+
| Eproj (e1, i1), Eproj (e2, i2) ->
162+
i1 = i2 && aux alpha e1 e2
163+
159164
| _, _ -> false
160165

161-
in fun alpha e1 e2 -> aux alpha e1 e2
166+
in fun alpha e1 e2 -> noconv (aux alpha) e1 e2
162167

163168
(* ------------------------------------------------------------------ *)
164169
let for_lv env ~norm lv1 lv2 =

src/phl/ecPhlUpto.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ and i_upto env alpha bad i1 i2 =
6464
f_upto env bad f1 f2
6565

6666
| Sif (a1, b1, c1), Sif(a2, b2, c2) ->
67-
EqTest.for_expr env a1 a2 &&
67+
EqTest.for_expr env ~alpha a1 a2 &&
6868
s_upto env alpha bad b1 b2 &&
6969
s_upto env alpha bad c1 c2
7070

7171
| Swhile(a1,b1), Swhile(a2,b2) ->
72-
EqTest.for_expr env a1 a2 &&
72+
EqTest.for_expr env ~alpha a1 a2 &&
7373
s_upto env alpha bad b1 b2
7474

7575
| Smatch(e1,bs1), Smatch(e2,bs2) when List.length bs1 = List.length bs2 -> begin

0 commit comments

Comments
 (0)