@@ -349,6 +349,33 @@ module Constant = struct
349
349
| NativeInt _, (Int _ | Int32 _)
350
350
| (Int32 _ | NativeInt _), Float _
351
351
| Float _ , (Int32 _ | NativeInt _ ) -> None
352
+
353
+ let rec equal c c' =
354
+ match c, c' with
355
+ | String s , String s' -> String. equal s s'
356
+ | NativeString s , NativeString s' -> Native_string. equal s s'
357
+ | Float f , Float f' -> Float. bitwise_equal f f'
358
+ | Float_array a , Float_array a' -> Array. equal Float. bitwise_equal a a'
359
+ | Int i , Int i' -> Targetint. equal i i'
360
+ | Int32 i , Int32 i' | NativeInt i , NativeInt i' -> Int32. equal i i'
361
+ | Int64 i , Int64 i' -> Int64. equal i i'
362
+ | Tuple (t , a , kind ), Tuple (t' , a' , kind' ) -> (
363
+ t = t'
364
+ && Array. equal equal a a'
365
+ &&
366
+ match kind, kind' with
367
+ | Array , Array | NotArray , NotArray | Unknown , Unknown -> true
368
+ | (Array | NotArray | Unknown ), _ -> false )
369
+ | ( ( String _
370
+ | NativeString _
371
+ | Float _
372
+ | Float_array _
373
+ | Int _
374
+ | Int32 _
375
+ | NativeInt _
376
+ | Int64 _
377
+ | Tuple _ )
378
+ , _ ) -> false
352
379
end
353
380
354
381
type loc =
@@ -795,18 +822,15 @@ let eq p1 p2 =
795
822
&& List. equal
796
823
~eq: (fun i i' ->
797
824
match i, i' with
798
- | Let (x , Constant (Float f )), Let (x' , Constant (Float f' )) ->
799
- Var. equal x x' && Float. bitwise_equal f f'
800
- | ( Let (x, Constant (Float_array a))
801
- , Let (x', Constant (Float_array a')) ) ->
802
- Var. equal x x' && Array. equal Float. bitwise_equal a a'
825
+ | Let (x , Constant c ), Let (x' , Constant c' ) ->
826
+ Var. equal x x' && Constant. equal c c'
803
827
| Let (x , Prim (prim , args )), Let (x' , Prim (prim' , args' )) ->
804
828
Var. equal x x'
805
829
&& Poly. equal prim prim'
806
830
&& List. equal
807
831
~eq: (fun a a' ->
808
832
match a, a' with
809
- | Pc (Float f ) , Pc (Float f' ) -> Float. bitwise_equal f f '
833
+ | Pc c , Pc c' -> Constant. equal c c '
810
834
| _ -> Poly. equal a a')
811
835
args
812
836
args'
0 commit comments