Skip to content

Commit 38dd32c

Browse files
authored
Special case polymorphic compare for physically equal value.
This follows the ocaml implementation. See rescript-lang#2142
1 parent ba4efb2 commit 38dd32c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

jscomp/runtime/caml_obj.ml

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ let unsafe_js_compare x y =
153153
as well as the [List.sort] and [Array.sort] functions.
154154
*)
155155
let rec caml_compare (a : Obj.t) (b : Obj.t) : int =
156+
if a == b then 0 else
156157
(*front and formoest, we do not compare function values*)
157158
let a_type = Js.typeof a in
158159
let b_type = Js.typeof b in

0 commit comments

Comments
 (0)