Shadow the physical equality operator

This commit is contained in:
Jacques-Pascal Deplaix 2017-12-31 11:58:47 +01:00
parent ff69945575
commit 3c808f397e
7 changed files with 18 additions and 13 deletions

View file

@ -862,7 +862,7 @@ module Deque = struct
let take_back d =
match !d with
| None -> raise Empty
| Some first when first == first.prev ->
| Some first when Pervasives.(==) first first.prev ->
(* only one element *)
d := None;
first.content
@ -875,7 +875,7 @@ module Deque = struct
let take_front d =
match !d with
| None -> raise Empty
| Some first when first == first.prev ->
| Some first when Pervasives.(==) first first.prev ->
(* only one element *)
d := None;
first.content

View file

@ -222,7 +222,7 @@ module LRU(X:HASH) = struct
(* take first from queue *)
let take_ c =
match c.first with
| Some n when n.next == n ->
| Some n when Pervasives.(==) n.next n ->
(* last element *)
c.first <- None;
n
@ -241,7 +241,7 @@ module LRU(X:HASH) = struct
n.next <- n;
n.prev <- n;
c.first <- Some n
| Some n1 when n1==n -> ()
| Some n1 when Pervasives.(==) n1 n -> ()
| Some n1 ->
n.prev <- n1.prev;
n.next <- n1;

View file

@ -163,7 +163,7 @@ let take_back_node_ n = match n.cell with
let take_back d =
if is_empty d then raise Empty
else if d.cur == d.cur.prev
else if Pervasives.(==) d.cur d.cur.prev
then (
(* only one cell *)
decr_size_ d;
@ -196,7 +196,7 @@ let take_front_node_ n = match n.cell with
let take_front d =
if is_empty d then raise Empty
else if d.cur.prev == d.cur
else if Pervasives.(==) d.cur.prev d.cur
then (
(* only one cell *)
decr_size_ d;
@ -255,7 +255,7 @@ let fold f acc d =
| Two (x,y) -> f (f acc x) y
| Three (x,y,z) -> f (f (f acc x) y) z
in
if n.next == first then acc else aux ~first f acc n.next
if Pervasives.(==) n.next first then acc else aux ~first f acc n.next
in
aux ~first:d.cur f acc d.cur
@ -337,7 +337,7 @@ let to_gen q =
let cell = ref q.cur.cell in
let cur = ref q.cur in
let rec next () = match !cell with
| Zero when (!cur).next == first -> None
| Zero when Pervasives.(==) (!cur).next first -> None
| Zero ->
(* go to next node *)
let n = !cur in

View file

@ -24,7 +24,7 @@ module Transient = struct
type state = { mutable frozen: bool }
type t = Nil | St of state
let empty = Nil
let equal a b = a==b
let equal a b = Pervasives.(==) a b
let create () = St {frozen=false}
let active = function Nil -> false | St st -> not st.frozen
let frozen = function Nil -> true | St st -> st.frozen
@ -299,7 +299,7 @@ module Make(Key : KEY)
type t = int
let make = Key.hash
let zero = 0
let is_0 h = h==0
let is_0 h = h = 0
let equal (a : int) b = Pervasives.(=) a b
let rem h = h land (A.length - 1)
let quotient h = h lsr A.length_log

View file

@ -240,7 +240,7 @@ let update k f t =
let doubleton k1 v1 k2 v2 = add k1 v1 (singleton k2 v2)
let rec equal ~eq a b = a==b || match a, b with
let rec equal ~eq a b = Pervasives.(==) a b || match a, b with
| E, E -> true
| L (ka, va), L (kb, vb) -> ka = kb && eq va vb
| N (pa, sa, la, ra), N (pb, sb, lb, rb) ->
@ -290,7 +290,7 @@ let choose t =
with Not_found -> None
let rec union f t1 t2 =
if t1==t2 then t1
if Pervasives.(==) t1 t2 then t1
else match t1, t2 with
| E, o | o, E -> o
| L (k, v), o
@ -345,7 +345,7 @@ let rec union f t1 t2 =
*)
let rec inter f a b =
if a==b then a
if Pervasives.(==) a b then a
else match a, b with
| E, _ | _, E -> E
| L (k, v), o

View file

@ -2,3 +2,5 @@
(* This file is free software, part of containers. See file "license" for more details. *)
include Pervasives
let (==) = `Consider_using_CCEqual_physical

View file

@ -14,3 +14,6 @@ val (>=) : int -> int -> bool
val compare : int -> int -> int
val min : int -> int -> int
val max : int -> int -> int
val (==) : [`Consider_using_CCEqual_physical]
[@@ocaml.deprecated "Please use CCEqual.physical instead."]