Skip to content

Commit 3171d50

Browse files
authored
Fix uses of polymorphic comparison in Flambda 2 (oxcaml#2312)
* Add -open Int_replace_polymorphic_compare for flambda2 * Remove explicit opens of Int_replace_polymorphic_compare * Fix occurrences of polymorphic comparison
1 parent bebad53 commit 3171d50

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+168
-121
lines changed

middle_end/flambda2/algorithms/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
(flags
88
(:standard -principal))
99
(ocamlopt_flags
10-
(:standard -O3))
10+
(:standard -O3 -open Int_replace_polymorphic_compare))
1111
(libraries ocamlcommon))

middle_end/flambda2/algorithms/lmap.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ module Make (T : Thing) : S with type key = T.t = struct
7878

7979
let empty = []
8080

81-
let is_empty m = m = []
81+
let is_empty m = match m with [] -> true | _ :: _ -> false
8282

8383
let add k v m = (k, v) :: m
8484

@@ -147,9 +147,9 @@ module Make (T : Thing) : S with type key = T.t = struct
147147
let of_seq m = List.of_seq m
148148

149149
let print_assoc print_key print_datum ppf l =
150-
if l = []
151-
then Format.fprintf ppf "{}"
152-
else
150+
match l with
151+
| [] -> Format.fprintf ppf "{}"
152+
| _ :: _ ->
153153
Format.fprintf ppf "@[<hov 1>{%a}@]"
154154
(Format.pp_print_list ~pp_sep:Format.pp_print_space
155155
(fun ppf (key, datum) ->

middle_end/flambda2/algorithms/patricia_tree.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
(* *)
1313
(**************************************************************************)
1414

15-
open! Int_replace_polymorphic_compare
16-
1715
(* The following is a "little endian" implementation. *)
1816

1917
(* CR-someday mshinwell: Can we fix the traversal order by swapping endianness?

middle_end/flambda2/bound_identifiers/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
-open
1919
Flambda2_ui))
2020
(ocamlopt_flags
21-
(:standard -O3))
21+
(:standard -O3 -open Int_replace_polymorphic_compare))
2222
(libraries
2323
ocamlcommon
2424
flambda2_algorithms

middle_end/flambda2/classic_mode_types/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
-open
1818
Flambda2_term_basics))
1919
(ocamlopt_flags
20-
(:standard -O3))
20+
(:standard -O3 -open Int_replace_polymorphic_compare))
2121
(libraries
2222
ocamlcommon
2323
flambda2_identifiers

middle_end/flambda2/cmx/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
-open
3333
Flambda2_ui))
3434
(ocamlopt_flags
35-
(:standard -O3))
35+
(:standard -O3 -open Int_replace_polymorphic_compare))
3636
(libraries
3737
ocamlcommon
3838
flambda_backend_utils

middle_end/flambda2/compare/compare.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[@@@ocaml.warning "-fragile-match"]
22

3-
open! Int_replace_polymorphic_compare
43
open! Flambda
54

65
(* General notes on comparison

middle_end/flambda2/compare/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424
-open
2525
Flambda2_terms))
2626
(ocamlopt_flags
27-
(:standard -O3))
27+
(:standard -O3 -open Int_replace_polymorphic_compare))
2828
(libraries ocamlcommon flambda2_algorithms flambda2_terms))

middle_end/flambda2/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
-open
3333
Flambda2_ui))
3434
(ocamlopt_flags
35-
(:standard -O3))
35+
(:standard -O3 -open Int_replace_polymorphic_compare))
3636
(modules flambda2)
3737
(libraries
3838
ocamlcommon

middle_end/flambda2/from_lambda/closure_conversion.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
[@@@ocaml.warning "-fragile-match"]
1818

19-
open! Int_replace_polymorphic_compare
2019
open! Flambda
2120
module BP = Bound_parameter
2221
module IR = Closure_conversion_aux.IR

0 commit comments

Comments
 (0)