From d2f84975903d1395bd2092889edbf6287370b16e Mon Sep 17 00:00:00 2001 From: Javier Chavarri Date: Mon, 26 Aug 2024 16:34:19 +0000 Subject: [PATCH] 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))))