Skip to content

Commit 9cbd8fd

Browse files
author
Cristiano Calcagno
committed
Deprecate type Js.boolean
There’s one issue with deprecating types, where other occurrences of the type in the .mli also trigger the deprecation, see https://caml.inria.fr/mantis/view.php?id=7005 . In particular, the deprecation of true_ mentions boolean, and when compiled, js.mli triggers a deprecation warning. Adding `[@@ocaml.warning “-3”]` did not help. So I’ve made deprecation warnings not fatal on `jscomp/runtime`.
1 parent 6866580 commit 9cbd8fd

File tree

12 files changed

+33
-32
lines changed

12 files changed

+33
-32
lines changed

jscomp/others/js_boolean.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424

2525
(** Contains functions for dealing with JavaScript booleans *)
2626

27-
external to_js_boolean : bool -> Js.boolean = "%identity"
27+
external to_js_boolean : bool -> bool = "%identity"
2828

jscomp/others/js_boolean.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424

2525
(** Contains functions for dealing with JavaScript booleans *)
2626

27-
external to_js_boolean : bool -> Js.boolean = "%identity"
27+
external to_js_boolean : bool -> bool = "%identity"
2828
[@@ocaml.deprecated "This function is not needed any more"]

jscomp/others/js_json.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type _ kind =
3131
| Number : float kind
3232
| Object : t Js_dict.t kind
3333
| Array : t array kind
34-
| Boolean : Js.boolean kind
34+
| Boolean : bool kind
3535
| Null : Js_types.null_val kind
3636

3737

@@ -94,7 +94,7 @@ let decodeArray json =
9494

9595
let decodeBoolean json =
9696
if Js.typeof json = "boolean"
97-
then Some (Obj.magic (json:t) : Js.boolean)
97+
then Some (Obj.magic (json:t) : bool)
9898
else None
9999

100100
let decodeNull json =
@@ -115,15 +115,15 @@ external stringifyAny : 'a -> string option =
115115
external null : t = "" [@@bs.val]
116116
external string : string -> t = "%identity"
117117
external number : float -> t = "%identity"
118-
external boolean : Js.boolean -> t = "%identity"
118+
external boolean : bool -> t = "%identity"
119119
external object_ : t Js_dict.t -> t = "%identity"
120120

121121
external array_ : t array -> t = "%identity"
122122

123123
external array : t array -> t = "%identity"
124124
external stringArray : string array -> t = "%identity"
125125
external numberArray : float array -> t = "%identity"
126-
external booleanArray : Js.boolean array -> t = "%identity"
126+
external booleanArray : bool array -> t = "%identity"
127127
external objectArray : t Js_dict.t array -> t = "%identity"
128128
external stringify: t -> string = "stringify"
129129
[@@bs.val] [@@bs.scope "JSON"]

jscomp/others/js_json.mli

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type _ kind =
3838
| Number : float kind
3939
| Object : t Js_dict.t kind
4040
| Array : t array kind
41-
| Boolean : Js.boolean kind
41+
| Boolean : bool kind
4242
| Null : Js_types.null_val kind
4343

4444
type tagged_t =
@@ -75,7 +75,7 @@ val decodeArray : t -> t array option
7575
(** [decodeArray json] returns [Some a] if [json] is an array, [None]
7676
otherwise *)
7777

78-
val decodeBoolean : t -> Js.boolean option
78+
val decodeBoolean : t -> bool option
7979
(** [decodeBoolean json] returns [Some b] if [json] is a boolean, [None]
8080
otherwise *)
8181

@@ -98,8 +98,8 @@ external string : string -> t = "%identity"
9898
external number : float -> t = "%identity"
9999
(** [number n] makes a JSON number of the [float] [n] *)
100100

101-
external boolean : Js.boolean -> t = "%identity"
102-
(** [boolean b] makes a JSON boolean of the [Js.boolean] [b] *)
101+
external boolean : bool -> t = "%identity"
102+
(** [boolean b] makes a JSON boolean of the [bool] [b] *)
103103

104104
external object_ : t Js_dict.t -> t = "%identity"
105105
(** [object_ dict] makes a JSON objet of the [Js.Dict.t] [dict] *)
@@ -118,8 +118,8 @@ external stringArray : string array -> t = "%identity"
118118
external numberArray : float array -> t = "%identity"
119119
(** [numberArray a] makes a JSON array of the [float array] [a] *)
120120

121-
external booleanArray : Js.boolean array -> t = "%identity"
122-
(** [booleanArray] makes a JSON array of the [Js.boolean array] [a] *)
121+
external booleanArray : bool array -> t = "%identity"
122+
(** [booleanArray] makes a JSON array of the [bool array] [a] *)
123123

124124
external objectArray : t Js_dict.t array -> t = "%identity"
125125
(** [objectArray a] makes a JSON array of the [JsDict.t array] [a] *)

jscomp/others/js_types.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type function_val
3737
type _ t =
3838
| Undefined : undefined_val t
3939
| Null : null_val t
40-
| Boolean : Js.boolean t
40+
| Boolean : bool t
4141
| Number : float t
4242
| String : string t
4343
| Function : function_val t

jscomp/others/js_types.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type function_val
3838
type _ t =
3939
| Undefined : undefined_val t
4040
| Null : null_val t
41-
| Boolean : Js.boolean t
41+
| Boolean : bool t
4242
| Number : float t
4343
| String : string t
4444
| Function : function_val t

jscomp/others/node.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type node_module = <
4545

4646
filename : string ;
4747

48-
loaded : Js.boolean;
48+
loaded : bool;
4949
children : node_module array ;
5050
paths : string array;
5151
> Js.t

jscomp/others/node_fs.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ module Watch = struct
4747
type t
4848
type config
4949
external config :
50-
?persistent:Js.boolean ->
51-
?recursive:Js.boolean ->
50+
?persistent: bool ->
51+
?recursive: bool ->
5252
?encoding: Js_string.t ->
5353
unit -> config =
5454
"" [@@bs.obj]

jscomp/runtime/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ BS_COMMON_FLAGS= -absname -no-alias-deps -bs-no-version-header -bs-diagnose -bs-
4040

4141
BS_FLAGS= $(BS_COMMON_FLAGS) $(BS_PKG_FLAGS)
4242

43-
COMPFLAGS += $(BS_FLAGS) -I ../stdlib -nostdlib -nopervasives -open Pervasives -unsafe -warn-error A -w -40-49-103 -bin-annot
43+
COMPFLAGS += $(BS_FLAGS) -I ../stdlib -nostdlib -nopervasives -open Pervasives -unsafe -warn-error -3 -w -40-49-103 -bin-annot
4444

4545

4646
$(RUNTIME): $(COMPILER)

jscomp/runtime/caml_basic.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
val none : 'a option
2929
val some : 'a -> 'a option
30-
val is_none : 'a option -> Js.boolean
30+
val is_none : 'a option -> bool
3131
val to_def : 'a option -> 'a Js_undefined.t
3232
val cons : 'a -> 'a list -> 'a list
33-
val is_list_empty : 'a list -> Js.boolean
33+
val is_list_empty : 'a list -> bool

0 commit comments

Comments
 (0)