From 8d4151c49363e4059d3dc29780abeceeb8551962 Mon Sep 17 00:00:00 2001 From: Javier Chavarri Date: Mon, 26 Aug 2024 15:52:42 +0000 Subject: [PATCH 1/4] ppx: qualify usages of stdlib infix operators --- ppx/browser/ppx_deriving_json_js.ml | 29 +++--- ppx/test/ppx_deriving_json_js.t | 136 ++++++++++++++++------------ 2 files changed, 95 insertions(+), 70 deletions(-) diff --git a/ppx/browser/ppx_deriving_json_js.ml b/ppx/browser/ppx_deriving_json_js.ml index 4be4695..e28a060 100644 --- a/ppx/browser/ppx_deriving_json_js.ml +++ b/ppx/browser/ppx_deriving_json_js.ml @@ -55,9 +55,11 @@ module Of_json = struct let eis_json_object ~loc x = [%expr - Js.typeof [%e x] = "object" - && (not (Js.Array.isArray [%e x])) - && not ((Obj.magic [%e x] : 'a Js.null) == Js.null)] + Stdlib.( && ) + (Js.typeof [%e x] = "object") + (Stdlib.( && ) + (not (Js.Array.isArray [%e x])) + (not (Stdlib.( == ) (Obj.magic [%e x] : 'a Js.null) Js.null)))] let ensure_json_object ~loc x = [%expr @@ -67,7 +69,7 @@ module Of_json = struct let ensure_json_array_len ~loc n len = [%expr - if [%e len] <> [%e eint ~loc n] then + if Stdlib.( <> ) [%e len] [%e eint ~loc n] then Ppx_deriving_json_runtime.of_json_error [%e estring ~loc (sprintf "expected a JSON array of length %i" n)]] @@ -77,9 +79,11 @@ module Of_json = struct let n = List.length t.tpl_types in [%expr if - Js.Array.isArray [%e x] - && Js.Array.length (Obj.magic [%e x] : Js.Json.t array) - = [%e eint ~loc n] + Stdlib.( && ) + (Js.Array.isArray [%e x]) + (Stdlib.( = ) + (Js.Array.length (Obj.magic [%e x] : Js.Json.t array)) + [%e eint ~loc n]) then let es = (Obj.magic [%e x] : Js.Json.t array) in [%e build_tuple ~loc derive 0 t.tpl_types [%expr es]] @@ -113,7 +117,7 @@ module Of_json = struct if Js.Array.isArray [%e x] then let array = (Obj.magic [%e x] : Js.Json.t array) in let len = Js.Array.length array in - if len > 0 then + if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in if Js.typeof tag = "string" then let tag = (Obj.magic tag : string) in @@ -135,13 +139,14 @@ module Of_json = struct let loc = n.loc in let n = Option.value ~default:n (vcs_attr_json_as ctx) in [%expr - if tag = [%e estring ~loc:n.loc n.txt] then [%e make None] + if Stdlib.( = ) tag [%e estring ~loc:n.loc n.txt] then + [%e make None] else [%e next]] | Vcs_record (n, r) -> let loc = n.loc in let n = Option.value ~default:n (vcs_attr_json_as r.rcd_ctx) in [%expr - if tag = [%e estring ~loc:n.loc n.txt] then ( + if Stdlib.( = ) tag [%e estring ~loc:n.loc n.txt] then ( [%e ensure_json_array_len ~loc 2 [%expr len]]; let fs = Js.Array.unsafe_get array 1 in [%e ensure_json_object ~loc [%expr fs]]; @@ -154,10 +159,10 @@ module Of_json = struct let n = Option.value ~default:n (vcs_attr_json_as t.tpl_ctx) in let arity = List.length t.tpl_types in [%expr - if tag = [%e estring ~loc:n.loc n.txt] then ( + if Stdlib.( = ) tag [%e estring ~loc:n.loc n.txt] then ( [%e ensure_json_array_len ~loc (arity + 1) [%expr len]]; [%e - if arity = 0 then make None + if Stdlib.( = ) arity 0 then make None else make (Some diff --git a/ppx/test/ppx_deriving_json_js.t b/ppx/test/ppx_deriving_json_js.t index 70fc2f2..584de4e 100644 --- a/ppx/test/ppx_deriving_json_js.t +++ b/ppx/test/ppx_deriving_json_js.t @@ -78,8 +78,10 @@ let rec tuple_of_json = (fun x -> if - Js.Array.isArray x - && Js.Array.length (Obj.magic x : Js.Json.t array) = 2 + Stdlib.( && ) (Js.Array.isArray x) + (Stdlib.( = ) + (Js.Array.length (Obj.magic x : Js.Json.t array)) + 2) then let es = (Obj.magic x : Js.Json.t array) in ( int_of_json (Js.Array.unsafe_get es 0), @@ -118,9 +120,11 @@ (fun x -> if not - (Js.typeof x = "object" - && (not (Js.Array.isArray x)) - && not ((Obj.magic x : 'a Js.null) == Js.null)) + (Stdlib.( && ) + (Js.typeof x = "object") + (Stdlib.( && ) + (not (Js.Array.isArray x)) + (not (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) then Ppx_deriving_json_runtime.of_json_error "expected a JSON object"; let fs = @@ -180,9 +184,11 @@ (fun x -> if not - (Js.typeof x = "object" - && (not (Js.Array.isArray x)) - && not ((Obj.magic x : 'a Js.null) == Js.null)) + (Stdlib.( && ) + (Js.typeof x = "object") + (Stdlib.( && ) + (not (Js.Array.isArray x)) + (not (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) then Ppx_deriving_json_runtime.of_json_error "expected a JSON object"; let fs = @@ -239,9 +245,11 @@ (fun x -> if not - (Js.typeof x = "object" - && (not (Js.Array.isArray x)) - && not ((Obj.magic x : 'a Js.null) == Js.null)) + (Stdlib.( && ) + (Js.typeof x = "object") + (Stdlib.( && ) + (not (Js.Array.isArray x)) + (not (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) then Ppx_deriving_json_runtime.of_json_error "expected a JSON object"; let fs = (Obj.magic x : < k : Js.Json.t Js.undefined > Js.t) in @@ -283,30 +291,35 @@ if Js.Array.isArray x then let array = (Obj.magic x : Js.Json.t array) in let len = Js.Array.length array in - if len > 0 then + if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in if Js.typeof tag = "string" then let tag = (Obj.magic tag : string) in - if tag = "A" then ( - if len <> 1 then + if Stdlib.( = ) tag "A" then ( + if Stdlib.( <> ) len 1 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 1"; A) - else if tag = "B" then ( - if len <> 2 then + else if Stdlib.( = ) tag "B" then ( + if Stdlib.( <> ) len 2 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 2"; B (int_of_json (Js.Array.unsafe_get array 1))) - else if tag = "C" then ( - if len <> 2 then + else if Stdlib.( = ) tag "C" then ( + if Stdlib.( <> ) len 2 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 2"; let fs = Js.Array.unsafe_get array 1 in if not - (Js.typeof fs = "object" - && (not (Js.Array.isArray fs)) - && not ((Obj.magic fs : 'a Js.null) == Js.null)) + (Stdlib.( && ) + (Js.typeof fs = "object") + (Stdlib.( && ) + (not (Js.Array.isArray fs)) + (not + (Stdlib.( == ) + (Obj.magic fs : 'a Js.null) + Js.null)))) then Ppx_deriving_json_runtime.of_json_error "expected a JSON object"; @@ -372,7 +385,7 @@ let rec other_of_json_poly = (fun x -> let tag = Ppx_deriving_json_runtime.Primitives.string_of_json x in - if tag = "C" then Some `C else None + if Stdlib.( = ) tag "C" then Some `C else None : Js.Json.t -> other option) and other_of_json = @@ -407,17 +420,17 @@ if Js.Array.isArray x then let array = (Obj.magic x : Js.Json.t array) in let len = Js.Array.length array in - if len > 0 then + if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in if Js.typeof tag = "string" then let tag = (Obj.magic tag : string) in - if tag = "A" then ( - if len <> 1 then + if Stdlib.( = ) tag "A" then ( + if Stdlib.( <> ) len 1 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 1"; Some `A) - else if tag = "B" then ( - if len <> 2 then + else if Stdlib.( = ) tag "B" then ( + if Stdlib.( <> ) len 2 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 2"; Some (`B (int_of_json (Js.Array.unsafe_get array 1)))) @@ -477,12 +490,12 @@ if Js.Array.isArray x then let array = (Obj.magic x : Js.Json.t array) in let len = Js.Array.length array in - if len > 0 then + if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in if Js.typeof tag = "string" then let tag = (Obj.magic tag : string) in - if tag = "C" then ( - if len <> 2 then + if Stdlib.( = ) tag "C" then ( + if Stdlib.( <> ) len 2 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 2"; Some (`C (a_of_json (Js.Array.unsafe_get array 1)))) @@ -532,17 +545,17 @@ if Js.Array.isArray x then let array = (Obj.magic x : Js.Json.t array) in let len = Js.Array.length array in - if len > 0 then + if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in if Js.typeof tag = "string" then let tag = (Obj.magic tag : string) in - if tag = "A" then ( - if len <> 1 then + if Stdlib.( = ) tag "A" then ( + if Stdlib.( <> ) len 1 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 1"; A) - else if tag = "Fix" then ( - if len <> 2 then + else if Stdlib.( = ) tag "Fix" then ( + if Stdlib.( <> ) len 2 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 2"; Fix (recur_of_json (Js.Array.unsafe_get array 1))) @@ -590,17 +603,17 @@ if Js.Array.isArray x then let array = (Obj.magic x : Js.Json.t array) in let len = Js.Array.length array in - if len > 0 then + if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in if Js.typeof tag = "string" then let tag = (Obj.magic tag : string) in - if tag = "A" then ( - if len <> 1 then + if Stdlib.( = ) tag "A" then ( + if Stdlib.( <> ) len 1 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 1"; Some `A) - else if tag = "Fix" then ( - if len <> 2 then + else if Stdlib.( = ) tag "Fix" then ( + if Stdlib.( <> ) len 2 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 2"; Some @@ -655,8 +668,8 @@ let rec evar_of_json = (fun x -> let tag = Ppx_deriving_json_runtime.Primitives.string_of_json x in - if tag = "A" then A - else if tag = "b_aliased" then B + if Stdlib.( = ) tag "A" then A + else if Stdlib.( = ) tag "b_aliased" then B else Ppx_deriving_json_runtime.of_json_error "invalid JSON" : Js.Json.t -> evar) @@ -687,8 +700,8 @@ let rec epoly_of_json_poly = (fun x -> let tag = Ppx_deriving_json_runtime.Primitives.string_of_json x in - if tag = "A_aliased" then Some `a - else if tag = "b" then Some `b + if Stdlib.( = ) tag "A_aliased" then Some `a + else if Stdlib.( = ) tag "b" then Some `b else None : Js.Json.t -> epoly option) @@ -729,17 +742,17 @@ if Js.Array.isArray x then let array = (Obj.magic x : Js.Json.t array) in let len = Js.Array.length array in - if len > 0 then + if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in if Js.typeof tag = "string" then let tag = (Obj.magic tag : string) in - if tag = "A" then ( - if len <> 2 then + if Stdlib.( = ) tag "A" then ( + if Stdlib.( <> ) len 2 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 2"; A (a_of_json (Js.Array.unsafe_get array 1))) - else if tag = "B" then ( - if len <> 2 then + else if Stdlib.( = ) tag "B" then ( + if Stdlib.( <> ) len 2 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 2"; B (b_of_json (Js.Array.unsafe_get array 1))) @@ -784,9 +797,11 @@ (fun x -> if not - (Js.typeof x = "object" - && (not (Js.Array.isArray x)) - && not ((Obj.magic x : 'a Js.null) == Js.null)) + (Stdlib.( && ) + (Js.typeof x = "object") + (Stdlib.( && ) + (not (Js.Array.isArray x)) + (not (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) then Ppx_deriving_json_runtime.of_json_error "expected a JSON object"; let fs = (Obj.magic x : < a : Js.Json.t Js.undefined > Js.t) in @@ -830,20 +845,25 @@ if Js.Array.isArray x then let array = (Obj.magic x : Js.Json.t array) in let len = Js.Array.length array in - if len > 0 then + if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in if Js.typeof tag = "string" then let tag = (Obj.magic tag : string) in - if tag = "A" then ( - if len <> 2 then + if Stdlib.( = ) tag "A" then ( + if Stdlib.( <> ) len 2 then Ppx_deriving_json_runtime.of_json_error "expected a JSON array of length 2"; let fs = Js.Array.unsafe_get array 1 in if not - (Js.typeof fs = "object" - && (not (Js.Array.isArray fs)) - && not ((Obj.magic fs : 'a Js.null) == Js.null)) + (Stdlib.( && ) + (Js.typeof fs = "object") + (Stdlib.( && ) + (not (Js.Array.isArray fs)) + (not + (Stdlib.( == ) + (Obj.magic fs : 'a Js.null) + Js.null)))) then Ppx_deriving_json_runtime.of_json_error "expected a JSON object"; From aa256bfa1de4084eda1a2870f03c368e0e93459d Mon Sep 17 00:00:00 2001 From: Javier Chavarri Date: Mon, 26 Aug 2024 15:55:01 +0000 Subject: [PATCH 2/4] add missing ops --- ppx/browser/ppx_deriving_json_js.ml | 4 ++-- ppx/test/ppx_deriving_json_js.t | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ppx/browser/ppx_deriving_json_js.ml b/ppx/browser/ppx_deriving_json_js.ml index e28a060..356a451 100644 --- a/ppx/browser/ppx_deriving_json_js.ml +++ b/ppx/browser/ppx_deriving_json_js.ml @@ -56,7 +56,7 @@ module Of_json = struct let eis_json_object ~loc x = [%expr Stdlib.( && ) - (Js.typeof [%e x] = "object") + (Stdlib.( = ) (Js.typeof [%e x]) "object") (Stdlib.( && ) (not (Js.Array.isArray [%e x])) (not (Stdlib.( == ) (Obj.magic [%e x] : 'a Js.null) Js.null)))] @@ -119,7 +119,7 @@ module Of_json = struct let len = Js.Array.length array in if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in - if Js.typeof tag = "string" then + if Stdlib.( = ) (Js.typeof tag) "string" then let tag = (Obj.magic tag : string) in [%e body] else diff --git a/ppx/test/ppx_deriving_json_js.t b/ppx/test/ppx_deriving_json_js.t index 584de4e..3f654c3 100644 --- a/ppx/test/ppx_deriving_json_js.t +++ b/ppx/test/ppx_deriving_json_js.t @@ -121,7 +121,7 @@ if not (Stdlib.( && ) - (Js.typeof x = "object") + (Stdlib.( = ) (Js.typeof x) "object") (Stdlib.( && ) (not (Js.Array.isArray x)) (not (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) @@ -185,7 +185,7 @@ if not (Stdlib.( && ) - (Js.typeof x = "object") + (Stdlib.( = ) (Js.typeof x) "object") (Stdlib.( && ) (not (Js.Array.isArray x)) (not (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) @@ -246,7 +246,7 @@ if not (Stdlib.( && ) - (Js.typeof x = "object") + (Stdlib.( = ) (Js.typeof x) "object") (Stdlib.( && ) (not (Js.Array.isArray x)) (not (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) @@ -293,7 +293,7 @@ let len = Js.Array.length array in if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in - if Js.typeof tag = "string" then + if Stdlib.( = ) (Js.typeof tag) "string" then let tag = (Obj.magic tag : string) in if Stdlib.( = ) tag "A" then ( if Stdlib.( <> ) len 1 then @@ -313,7 +313,7 @@ if not (Stdlib.( && ) - (Js.typeof fs = "object") + (Stdlib.( = ) (Js.typeof fs) "object") (Stdlib.( && ) (not (Js.Array.isArray fs)) (not @@ -422,7 +422,7 @@ let len = Js.Array.length array in if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in - if Js.typeof tag = "string" then + if Stdlib.( = ) (Js.typeof tag) "string" then let tag = (Obj.magic tag : string) in if Stdlib.( = ) tag "A" then ( if Stdlib.( <> ) len 1 then @@ -492,7 +492,7 @@ let len = Js.Array.length array in if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in - if Js.typeof tag = "string" then + if Stdlib.( = ) (Js.typeof tag) "string" then let tag = (Obj.magic tag : string) in if Stdlib.( = ) tag "C" then ( if Stdlib.( <> ) len 2 then @@ -547,7 +547,7 @@ let len = Js.Array.length array in if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in - if Js.typeof tag = "string" then + if Stdlib.( = ) (Js.typeof tag) "string" then let tag = (Obj.magic tag : string) in if Stdlib.( = ) tag "A" then ( if Stdlib.( <> ) len 1 then @@ -605,7 +605,7 @@ let len = Js.Array.length array in if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in - if Js.typeof tag = "string" then + if Stdlib.( = ) (Js.typeof tag) "string" then let tag = (Obj.magic tag : string) in if Stdlib.( = ) tag "A" then ( if Stdlib.( <> ) len 1 then @@ -744,7 +744,7 @@ let len = Js.Array.length array in if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in - if Js.typeof tag = "string" then + if Stdlib.( = ) (Js.typeof tag) "string" then let tag = (Obj.magic tag : string) in if Stdlib.( = ) tag "A" then ( if Stdlib.( <> ) len 2 then @@ -798,7 +798,7 @@ if not (Stdlib.( && ) - (Js.typeof x = "object") + (Stdlib.( = ) (Js.typeof x) "object") (Stdlib.( && ) (not (Js.Array.isArray x)) (not (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) @@ -847,7 +847,7 @@ let len = Js.Array.length array in if Stdlib.( > ) len 0 then let tag = Js.Array.unsafe_get array 0 in - if Js.typeof tag = "string" then + if Stdlib.( = ) (Js.typeof tag) "string" then let tag = (Obj.magic tag : string) in if Stdlib.( = ) tag "A" then ( if Stdlib.( <> ) len 2 then @@ -857,7 +857,7 @@ if not (Stdlib.( && ) - (Js.typeof fs = "object") + (Stdlib.( = ) (Js.typeof fs) "object") (Stdlib.( && ) (not (Js.Array.isArray fs)) (not From ca1b51d0ed83216fff6e0598a3581ec7dc32d2ee Mon Sep 17 00:00:00 2001 From: Javier Chavarri Date: Mon, 26 Aug 2024 15:55:28 +0000 Subject: [PATCH 3/4] changelog --- CHANGES.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index a913f6e..8cc56cf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +## Unreleased + +- PPX: Qualify usages of infix operators with `Stdlib` + ([#11](https://github.com/melange-community/melange-json/pull/11)) + ## 1.2.0 (2024-08-16) - Port PPX from @andreypopp/ppx_deriving_json From d2f84975903d1395bd2092889edbf6287370b16e Mon Sep 17 00:00:00 2001 From: Javier Chavarri Date: Mon, 26 Aug 2024 16:34:19 +0000 Subject: [PATCH 4/4] qualify usages of `not` --- ppx/browser/ppx_deriving_json_js.ml | 7 ++--- ppx/test/ppx_deriving_json_js.t | 40 ++++++++++++++++------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/ppx/browser/ppx_deriving_json_js.ml b/ppx/browser/ppx_deriving_json_js.ml index 356a451..91e437d 100644 --- a/ppx/browser/ppx_deriving_json_js.ml +++ b/ppx/browser/ppx_deriving_json_js.ml @@ -58,12 +58,13 @@ module Of_json = struct Stdlib.( && ) (Stdlib.( = ) (Js.typeof [%e x]) "object") (Stdlib.( && ) - (not (Js.Array.isArray [%e x])) - (not (Stdlib.( == ) (Obj.magic [%e x] : 'a Js.null) Js.null)))] + (Stdlib.not (Js.Array.isArray [%e x])) + (Stdlib.not + (Stdlib.( == ) (Obj.magic [%e x] : 'a Js.null) Js.null)))] let ensure_json_object ~loc x = [%expr - if not [%e eis_json_object ~loc x] then + if Stdlib.not [%e eis_json_object ~loc x] then Ppx_deriving_json_runtime.of_json_error [%e estring ~loc (sprintf "expected a JSON object")]] diff --git a/ppx/test/ppx_deriving_json_js.t b/ppx/test/ppx_deriving_json_js.t index 3f654c3..066269c 100644 --- a/ppx/test/ppx_deriving_json_js.t +++ b/ppx/test/ppx_deriving_json_js.t @@ -119,12 +119,13 @@ let rec record_of_json = (fun x -> if - not + Stdlib.not (Stdlib.( && ) (Stdlib.( = ) (Js.typeof x) "object") (Stdlib.( && ) - (not (Js.Array.isArray x)) - (not (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) + (Stdlib.not (Js.Array.isArray x)) + (Stdlib.not + (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) then Ppx_deriving_json_runtime.of_json_error "expected a JSON object"; let fs = @@ -183,12 +184,13 @@ let rec record_aliased_of_json = (fun x -> if - not + Stdlib.not (Stdlib.( && ) (Stdlib.( = ) (Js.typeof x) "object") (Stdlib.( && ) - (not (Js.Array.isArray x)) - (not (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) + (Stdlib.not (Js.Array.isArray x)) + (Stdlib.not + (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) then Ppx_deriving_json_runtime.of_json_error "expected a JSON object"; let fs = @@ -244,12 +246,13 @@ let rec record_opt_of_json = (fun x -> if - not + Stdlib.not (Stdlib.( && ) (Stdlib.( = ) (Js.typeof x) "object") (Stdlib.( && ) - (not (Js.Array.isArray x)) - (not (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) + (Stdlib.not (Js.Array.isArray x)) + (Stdlib.not + (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) then Ppx_deriving_json_runtime.of_json_error "expected a JSON object"; let fs = (Obj.magic x : < k : Js.Json.t Js.undefined > Js.t) in @@ -311,12 +314,12 @@ "expected a JSON array of length 2"; let fs = Js.Array.unsafe_get array 1 in if - not + Stdlib.not (Stdlib.( && ) (Stdlib.( = ) (Js.typeof fs) "object") (Stdlib.( && ) - (not (Js.Array.isArray fs)) - (not + (Stdlib.not (Js.Array.isArray fs)) + (Stdlib.not (Stdlib.( == ) (Obj.magic fs : 'a Js.null) Js.null)))) @@ -796,12 +799,13 @@ let rec allow_extra_fields_of_json = (fun x -> if - not + Stdlib.not (Stdlib.( && ) (Stdlib.( = ) (Js.typeof x) "object") (Stdlib.( && ) - (not (Js.Array.isArray x)) - (not (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) + (Stdlib.not (Js.Array.isArray x)) + (Stdlib.not + (Stdlib.( == ) (Obj.magic x : 'a Js.null) Js.null)))) then Ppx_deriving_json_runtime.of_json_error "expected a JSON object"; let fs = (Obj.magic x : < a : Js.Json.t Js.undefined > Js.t) in @@ -855,12 +859,12 @@ "expected a JSON array of length 2"; let fs = Js.Array.unsafe_get array 1 in if - not + Stdlib.not (Stdlib.( && ) (Stdlib.( = ) (Js.typeof fs) "object") (Stdlib.( && ) - (not (Js.Array.isArray fs)) - (not + (Stdlib.not (Js.Array.isArray fs)) + (Stdlib.not (Stdlib.( == ) (Obj.magic fs : 'a Js.null) Js.null))))