Skip to content

Commit 57d213f

Browse files
committed
unused value warning -> error
1 parent a7c8bbd commit 57d213f

File tree

113 files changed

+12022
-12066
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+12022
-12066
lines changed

jscomp/bsb/bsb_config.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ let proj_rel path = lazy_src_root_dir // path
5757

5858

5959

60-
let cmd_package_specs = ref None
60+
(* let cmd_package_specs = ref None *)
6161

jscomp/bsb/bsb_config_parse.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

2525

26-
let get_list_string = Bsb_build_util.get_list_string
26+
(* let get_list_string = Bsb_build_util.get_list_string *)
2727
let (//) = Ext_path.combine
2828
let current_package : Bsb_pkg_types.t = Global Bs_version.package_name
2929
let resolve_package cwd package_name =
@@ -39,9 +39,9 @@ let (|?) m (key, cb) =
3939
m |> Ext_json.test key cb
4040

4141

42-
43-
let extract_main_entries (map :json_map) =
4442
#if BS_NATIVE then
43+
let extract_main_entries (map :json_map) =
44+
4545
let extract_entries (field : Ext_json_types.t array) =
4646
Ext_array.to_list_map (function
4747
| Ext_json_types.Obj {map} ->
@@ -76,7 +76,7 @@ let extract_main_entries (map :json_map) =
7676
| _ -> ()
7777
end; !entries
7878
#else
79-
[]
79+
let extract_main_entries (_ :json_map) = []
8080
#end
8181

8282

jscomp/bsb/bsb_db_util.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2525
type module_info = Bsb_db.module_info
2626
type t = Bsb_db.t
27-
type case = Bsb_db.case
27+
(* type case = Bsb_db.case *)
2828

2929

3030

jscomp/bsb/bsb_log.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ let color_functions : Format.formatter_tag_functions = {
4949
print_close_tag = (fun _ -> ())
5050
}
5151

52-
let set_color ppf =
53-
Format.pp_set_formatter_tag_functions ppf color_functions
52+
(* let set_color ppf =
53+
Format.pp_set_formatter_tag_functions ppf color_functions *)
5454

5555

5656
let setup () =

jscomp/bsb/bsb_merlin_gen.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ let merlin_file_gen ~per_proj_dir:(per_proj_dir:string)
110110
external_includes;
111111
reason_react_jsx ;
112112
namespace;
113-
package_name;
113+
package_name = _;
114114
warning;
115115
} : Bsb_config_types.t)
116116
=

jscomp/bsb/bsb_ninja_gen.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ let (//) = Ext_path.combine
3131

3232

3333

34-
let dash_i = "-I"
34+
(* let dash_i = "-I" *)
3535

3636

3737

@@ -184,8 +184,8 @@ let output_ninja_and_namespace_map
184184
Bsb_db_util.sanity_check bs_group;
185185
[|bs_group|], source_dirs, static_resources
186186
else
187-
let bs_groups = Array.init (number_of_dev_groups + 1 ) (fun i -> Map_string.empty) in
188-
let source_dirs = Array.init (number_of_dev_groups + 1 ) (fun i -> []) in
187+
let bs_groups = Array.init (number_of_dev_groups + 1 ) (fun _ -> Map_string.empty) in
188+
let source_dirs = Array.init (number_of_dev_groups + 1 ) (fun _ -> []) in
189189
let static_resources =
190190
Ext_list.fold_left bs_file_groups [] (fun (acc_resources : string list) {sources; dir; resources; dir_index}
191191
->

jscomp/bsb/bsb_parse_sources.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type build_generator = Bsb_file_groups.build_generator
2828

2929

3030

31-
type file_group = Bsb_file_groups.file_group
31+
(* type file_group = Bsb_file_groups.file_group *)
3232

3333
type t = Bsb_file_groups.t
3434

@@ -134,7 +134,7 @@ type json_map = Ext_json_types.t Map_string.t
134134

135135
let extract_generators (input : json_map) : build_generator list =
136136
match Map_string.find_opt input Bsb_build_schemas.generators with
137-
| Some (Arr { content ; loc_start}) ->
137+
| Some (Arr { content ; loc_start= _}) ->
138138
(* Need check is dev build or not *)
139139
Ext_array.fold_left content [] (fun acc x ->
140140
match x with
@@ -294,7 +294,7 @@ let rec
294294
Bsb_db_util.add_basename ~dir acc basename ~error_on_invalid_suffix:loc
295295
| _ -> acc
296296
)
297-
| Some (Obj {map = map; loc} ) -> (* { excludes : [], slow_re : "" }*)
297+
| Some (Obj {map = map; loc = _} ) -> (* { excludes : [], slow_re : "" }*)
298298
let predicate = extract_predicate map in
299299
Ext_array.fold_left (Lazy.force base_name_array) output_sources (fun acc basename ->
300300
if is_input_or_output scanned_generators basename || not (predicate basename) then acc

jscomp/bsb/bsb_unix.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ let run_command_execv_unix cmd : int =
4949
Unix.execv cmd.cmd cmd.args
5050
| pid ->
5151
match Unix.waitpid [] pid with
52-
| pid, process_status ->
52+
| _, process_status ->
5353
match process_status with
5454
| Unix.WEXITED eid ->
5555
eid

jscomp/bsb/bsb_world.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ let (//) = Ext_path.combine
2828
(** TODO: create the animation effect
2929
logging installed files
3030
*)
31-
let install_targets cwd ({files_to_install; namespace; package_name} : Bsb_config_types.t ) =
31+
let install_targets cwd ({files_to_install; namespace; package_name = _} : Bsb_config_types.t ) =
3232
let install ~destdir file =
3333
Bsb_file.install_if_exists ~destdir file |> ignore
3434
in

jscomp/bsb_helper/bsb_helper_dep_graph.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ let get_otherlibs_dependencies dependency_graph file_extension =
9898
else
9999
acc
100100
in
101-
let set_of_otherlib_deps = Map_string.fold dependency_graph Set_string.empty (fun k v acc ->
101+
let set_of_otherlib_deps = Map_string.fold dependency_graph Set_string.empty (fun _k v acc ->
102102
let addIfPresent = addIfPresentInSet v in
103103
acc
104104
|> addIfPresent "Unix" "unix"

jscomp/bsb_helper/bsb_helper_depfile_gen.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ let deps_of_channel (ic : in_channel) : string list =
8080
mostly for cutting the dependency so that [bsb_helper.exe] does
8181
not depend on compler-libs
8282
*)
83-
let read_deps (fn : string) : string list =
83+
(* let read_deps (fn : string) : string list =
8484
let ic = open_in_bin fn in
8585
let v = deps_of_channel ic in
8686
close_in ic;
8787
v
88-
88+
*)
8989

9090
type kind = Js | Bytecode | Native
9191

jscomp/common/lam_methname.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ let valid_start_char x =
131131
match x with
132132
| '_' | 'a' .. 'z' -> true
133133
| _ -> false
134-
let translate ?loc name =
134+
let translate name =
135135
assert (not @@ Ext_string.is_empty name);
136136
let i = Ext_string.rfind ~sub:double_underscore name in
137137
if i < 0 then

jscomp/common/lam_methname.mli

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@
2424

2525

2626

27-
val translate : ?loc:Location.t -> string -> string
27+
val translate :
28+
string -> string

jscomp/core/js_analyzer.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ let rec eq_expression
182182
| Number (Int j) -> i = j
183183
| _ -> false
184184
end
185-
| Number (Float i) ->
186-
begin match y0 with
185+
| Number (Float _) -> false
186+
(* begin match y0 with
187187
| Number (Float j) ->
188188
false (* conservative *)
189189
| _ -> false
190-
end
190+
end *)
191191
| String_index (a0,a1) ->
192192
begin match y0 with
193193
| String_index(b0,b1) ->
@@ -358,7 +358,7 @@ let rec is_constant (x : J.expression) =
358358
| Array (xs,_mutable_flag) -> Ext_list.for_all xs is_constant
359359
| Caml_block(xs, Immutable, tag, _)
360360
-> Ext_list.for_all xs is_constant && is_constant tag
361-
| Bin (op, a, b) ->
361+
| Bin (_op, a, b) ->
362362
is_constant a && is_constant b
363363
| _ -> false
364364

jscomp/core/js_ast_util.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727

2828

2929

30-
module E = Js_exp_make
30+
(* module E = Js_exp_make *)
3131

3232
module S = Js_stmt_make
3333

3434

35-
let rec named_expression (e : J.expression)
35+
let named_expression (e : J.expression)
3636
: (J.statement * Ident.t) option =
3737
if Js_analyzer.is_okay_to_duplicate e then
3838
None

jscomp/core/js_cmj_format.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type t = {
5454
npm_package_path : Js_packages_info.t ;
5555
cmj_case : cmj_case;
5656
}
57-
let empty_values = [||]
57+
(* let empty_values = [||] *)
5858
let mk ~values ~effect ~npm_package_path ~cmj_case : t =
5959
{
6060
values = Map_string.to_sorted_array values;
@@ -108,7 +108,7 @@ let from_string s : t =
108108

109109
let fixed_length = cmj_magic_number_length + digest_length
110110

111-
let rec for_sure_not_changed (name : string) (header : string) =
111+
let for_sure_not_changed (name : string) (header : string) =
112112
if Sys.file_exists name then
113113
let ic = open_in_bin name in
114114
let holder =

jscomp/core/js_dump.ml

+11-9
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
module P = Ext_pp
5555
module E = Js_exp_make
56-
module S = Js_stmt_make
56+
(* module S = Js_stmt_make *)
5757

5858
module L = Js_dump_lit
5959

@@ -226,12 +226,12 @@ let pp_paren_params
226226

227227
(** Print as underscore for unused vars, may not be
228228
needed in the future *)
229-
let ipp_ident cxt f id (un_used : bool) =
229+
(* let ipp_ident cxt f id (un_used : bool) =
230230
Ext_pp_scope.ident cxt f (
231231
if un_used then
232232
Ext_ident.make_unused ()
233233
else
234-
id)
234+
id) *)
235235

236236
let pp_var_assign cxt f id =
237237
P.string f L.var ;
@@ -279,9 +279,10 @@ let comma_sp f =
279279
let comma_nl f =
280280
comma f ; P.newline f
281281

282-
let drop_comment (x : J.expression) =
282+
(* let drop_comment (x : J.expression) =
283283
if x.comment = None then x
284-
else {x with comment = None}
284+
else {x with comment = None} *)
285+
285286
let debugger_nl f =
286287
P.newline f ;
287288
P.string f L.debugger;
@@ -300,7 +301,8 @@ let continue f s =
300301
P.string f s;
301302
semi f
302303

303-
let formal_parameter_list cxt f offset l env =
304+
305+
let formal_parameter_list cxt f l =
304306
iter_lst cxt f l Ext_pp_scope.ident comma_sp
305307
(* IdentMap *)
306308
(*
@@ -406,7 +408,7 @@ and pp_function is_method
406408
| [] -> assert false
407409
| this::arguments ->
408410
let cxt = P.paren_group f 1 (fun _ ->
409-
formal_parameter_list inner_cxt f 1 arguments env )
411+
formal_parameter_list inner_cxt f arguments )
410412
in
411413
P.space f ;
412414
P.brace_vgroup f 1 (fun _ ->
@@ -417,7 +419,7 @@ and pp_function is_method
417419
);
418420
else
419421
let cxt =
420-
P.paren_group f 1 (fun _ -> formal_parameter_list inner_cxt f 0 l env ) in
422+
P.paren_group f 1 (fun _ -> formal_parameter_list inner_cxt f l ) in
421423
P.space f ;
422424
P.brace_vgroup f 1 (fun _ -> function_body cxt f b )
423425
in
@@ -1014,7 +1016,7 @@ and variable_declaration top cxt f
10141016
cxt
10151017

10161018

1017-
and ipp_comment : 'a . P.t -> 'a -> unit = fun f comment ->
1019+
and ipp_comment : 'a . P.t -> 'a -> unit = fun _f _comment ->
10181020
()
10191021

10201022

jscomp/core/js_dump_lit.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
let function_ = "function"
2626
let var = "var" (* should be able to switch to [let] easily*)
2727
let return = "return"
28-
let eq = "="
28+
(* let eq = "=" *)
2929
let require = "require"
3030
let import = "import"
3131
let from = "from"

0 commit comments

Comments
 (0)