Repair broken unit-test

This commit is contained in:
Louis Gesbert 2024-02-07 18:14:41 +01:00
parent 68aaf6e2f0
commit c124943a6e
2 changed files with 5 additions and 8 deletions

View File

@ -125,10 +125,7 @@ let rec optimize_expr :
cases = cases2;
name = n2;
}
when false
(* TODO: this case is buggy because of the box/unbox manipulation, it
should be fixed before removing this [false] value*)
&& EnumName.equal n1 n2
when EnumName.equal n1 n2
&& all_match_cases_map_to_same_constructor cases1 n1 ->
(* iota-reduction when the matched expression is itself a match of the
same enum mapping all constructors to themselves *)
@ -146,7 +143,7 @@ let rec optimize_expr :
Some
(Expr.unbox
(Expr.make_abs [| v1 |]
(Expr.box
(Expr.rebox
(Bindlib.msubst b2
([e1] |> List.map fst |> Array.of_list)))
tys (Expr.pos e2)))
@ -473,7 +470,7 @@ let test_iota_reduction_2 () =
\ | B x D x\n\
after=match 1 with\n\
\ | A x C 20\n\
\ | B x D B x"
\ | B x D (B x)\n"
end
(Format.asprintf "before=@[%a@]@.after=%a@." Expr.format (Expr.unbox matchA)
Expr.format

View File

@ -5,7 +5,7 @@ let () =
( "Iota-reduction",
[
test_case "#1" `Quick Shared_ast.Optimizations.test_iota_reduction_1;
(* test_case "#2" `Quick
Shared_ast.Optimizations.test_iota_reduction_2; FIXME *)
test_case "#2" `Quick
Shared_ast.Optimizations.test_iota_reduction_2;
] );
]