Skip to content

Commit 313f16f

Browse files
authored
Remove some dead code. (#7312)
1 parent 55d7337 commit 313f16f

36 files changed

+25
-435
lines changed

compiler/core/js_of_lam_block.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ let make_block mutable_flag (tag_info : Lam_tag_info.t) tag args =
3333

3434
let field (field_info : Lam_compat.field_dbg_info) e (i : int32) =
3535
match field_info with
36-
| Fld_tuple | Fld_array ->
36+
| Fld_tuple ->
3737
E.array_index_by_int ?comment:(Lam_compat.str_of_field_info field_info) e i
3838
| Fld_poly_var_content -> E.poly_var_value_access e
3939
| Fld_poly_var_tag -> E.poly_var_tag_access e

compiler/core/lam_analysis.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ let rec no_side_effects (lam : Lam.t) : bool =
9797
(* TODO *)
9898
| Praw_js_code _
9999
(* byte swap *)
100-
| Parraysets | Parraysetu | Poffsetref _ | Praise | Plazyforce | Psetfield _
101-
->
100+
| Parraysets | Parraysetu | Poffsetref _ | Praise | Psetfield _ ->
102101
false)
103102
| Llet (_, _, arg, body) -> no_side_effects arg && no_side_effects body
104103
| Lswitch (_, _) -> false

compiler/core/lam_compat.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,10 @@ type field_dbg_info = Lambda.field_dbg_info =
7373
| Fld_extension
7474
| Fld_variant
7575
| Fld_cons
76-
| Fld_array
7776

7877
let str_of_field_info (x : field_dbg_info) : string option =
7978
match x with
80-
| Fld_array | Fld_extension | Fld_variant | Fld_cons | Fld_poly_var_tag
79+
| Fld_extension | Fld_variant | Fld_cons | Fld_poly_var_tag
8180
| Fld_poly_var_content | Fld_tuple ->
8281
None
8382
| Fld_record {name; _}

compiler/core/lam_compat.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ type field_dbg_info = Lambda.field_dbg_info =
3737
| Fld_extension
3838
| Fld_variant
3939
| Fld_cons
40-
| Fld_array
4140

4241
val str_of_field_info : field_dbg_info -> string option
4342

compiler/core/lam_compile_primitive.ml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,3 @@ let translate output_prefix loc (cxt : Lam_compile_context.t)
605605
match args with
606606
| [e1] -> E.runtime_call Primitive_modules.hash "hash_final_mix" args
607607
| _ -> assert false)
608-
| Plazyforce
609-
(* FIXME: we don't inline lazy force or at least
610-
let buckle handle it
611-
*)
612-
(* let parm = Ident.create "prim" in
613-
Lfunction(Curried, [parm],
614-
Matching.inline_lazy_force (Lvar parm) Location.none)
615-
It is inlined, this should not appear here *)
616-
->
617-
assert false

compiler/core/lam_constant_convert.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ let rec convert_constant (const : Lambda.structured_constant) : Lam_constant.t =
6363
if Ext_string.is_valid_hash_number name then
6464
Const_int {i = Ext_string.hash_number_as_i32_exn name; comment = None}
6565
else Const_pointer name)
66-
| Const_float_array s -> assert false
6766
| Const_immstring s -> Const_string {s; unicode = false}
6867
| Const_block (t, xs) -> (
6968
let tag = Lambda.tag_of_tag_info t in

compiler/core/lam_convert.ml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args loc : Lam.t =
229229
| Pfield (id, info) -> prim ~primitive:(Pfield (id, info)) ~args loc
230230
| Psetfield (id, info) -> prim ~primitive:(Psetfield (id, info)) ~args loc
231231
| Pduprecord -> prim ~primitive:Pduprecord ~args loc
232-
| Plazyforce -> prim ~primitive:Plazyforce ~args loc
233232
| Praise _ -> prim ~primitive:Praise ~args loc
234233
| Pobjcomp x -> prim ~primitive:(Pobjcomp x) ~args loc
235234
| Pobjorder -> prim ~primitive:Pobjorder ~args loc
@@ -248,8 +247,8 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args loc : Lam.t =
248247
| Paddint -> prim ~primitive:Paddint ~args loc
249248
| Psubint -> prim ~primitive:Psubint ~args loc
250249
| Pmulint -> prim ~primitive:Pmulint ~args loc
251-
| Pdivint _is_safe (*FIXME*) -> prim ~primitive:Pdivint ~args loc
252-
| Pmodint _is_safe (*FIXME*) -> prim ~primitive:Pmodint ~args loc
250+
| Pdivint -> prim ~primitive:Pdivint ~args loc
251+
| Pmodint -> prim ~primitive:Pmodint ~args loc
253252
| Pandint -> prim ~primitive:Pandint ~args loc
254253
| Porint -> prim ~primitive:Porint ~args loc
255254
| Pxorint -> prim ~primitive:Pxorint ~args loc
@@ -334,11 +333,6 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args loc : Lam.t =
334333
| Pjs_fn_make arity -> prim ~primitive:(Pjs_fn_make arity) ~args loc
335334
| Pjs_fn_make_unit -> prim ~primitive:Pjs_fn_make_unit ~args loc
336335
| Pjs_fn_method -> prim ~primitive:Pjs_fn_method ~args loc
337-
| Pjs_unsafe_downgrade ->
338-
let primitive : Lam_primitive.t =
339-
Pjs_unsafe_downgrade {name = Ext_string.empty; setter = false}
340-
in
341-
prim ~primitive ~args loc
342336

343337
(* Does not exist since we compile array in js backend unlike native backend *)
344338

compiler/core/lam_primitive.ml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ type t =
4040
| Psetfield of int * Lam_compat.set_field_dbg_info
4141
(* could have field info at least for record *)
4242
| Pduprecord
43-
(* Force lazy values *)
44-
| Plazyforce
4543
(* External call *)
4644
| Pjs_call of {
4745
prim_name: string;
@@ -222,10 +220,10 @@ let eq_primitive_approx (lhs : t) (rhs : t) =
222220
| Pjs_apply | Pjs_runtime_apply | Pval_from_option | Pval_from_option_not_nest
223221
| Pundefined_to_opt | Pnull_to_opt | Pnull_undefined_to_opt | Pis_null
224222
| Pis_not_none | Psome | Psome_not_nest | Pis_undefined | Pis_null_undefined
225-
| Pimport | Ptypeof | Pfn_arity | Plazyforce | Pis_poly_var_block | Pdebugger
226-
| Pinit_mod | Pupdate_mod | Pduprecord | Pmakearray | Parraylength
227-
| Parrayrefu | Parraysetu | Parrayrefs | Parraysets | Pjs_fn_make_unit
228-
| Pjs_fn_method | Phash | Phash_mixstring | Phash_mixint | Phash_finalmix ->
223+
| Pimport | Ptypeof | Pfn_arity | Pis_poly_var_block | Pdebugger | Pinit_mod
224+
| Pupdate_mod | Pduprecord | Pmakearray | Parraylength | Parrayrefu
225+
| Parraysetu | Parrayrefs | Parraysets | Pjs_fn_make_unit | Pjs_fn_method
226+
| Phash | Phash_mixstring | Phash_mixint | Phash_finalmix ->
229227
rhs = lhs
230228
| Pcreate_extension a -> (
231229
match rhs with

compiler/core/lam_primitive.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ type t =
3636
| Pfield of int * Lambda.field_dbg_info
3737
| Psetfield of int * Lambda.set_field_dbg_info
3838
| Pduprecord
39-
| Plazyforce
4039
| Pjs_call of {
4140
(* Location.t * [loc] is passed down *)
4241
prim_name: string;

compiler/core/lam_print.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ let primitive ppf (prim : Lam_primitive.t) =
8282
let instr = "setfield " in
8383
fprintf ppf "%s%i" instr n
8484
| Pduprecord -> fprintf ppf "duprecord"
85-
| Plazyforce -> fprintf ppf "force"
8685
| Pjs_call {prim_name} -> fprintf ppf "%s[js]" prim_name
8786
| Pjs_object_create _ -> fprintf ppf "[js.obj]"
8887
| Praise -> fprintf ppf "raise"

compiler/ml/datarepr.ml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,10 @@ let constructor_has_optional_shape
101101

102102
let constructor_descrs ty_path decl cstrs =
103103
let ty_res = newgenconstr ty_path decl.type_params in
104-
let num_consts = ref 0 and num_nonconsts = ref 0 and num_normal = ref 0 in
104+
let num_consts = ref 0 and num_nonconsts = ref 0 in
105105
List.iter
106-
(fun {cd_args; cd_res; _} ->
107-
if cd_args = Cstr_tuple [] then incr num_consts else incr num_nonconsts;
108-
if cd_res = None then incr num_normal)
106+
(fun {cd_args; _} ->
107+
if cd_args = Cstr_tuple [] then incr num_consts else incr num_nonconsts)
109108
cstrs;
110109
let rec describe_constructors idx_const idx_nonconst = function
111110
| [] -> []
@@ -154,7 +153,6 @@ let constructor_descrs ty_path decl cstrs =
154153
cstr_tag = tag;
155154
cstr_consts = !num_consts;
156155
cstr_nonconsts = !num_nonconsts;
157-
cstr_normal = !num_normal;
158156
cstr_private = decl.type_private;
159157
cstr_generalized = cd_res <> None;
160158
cstr_loc = cd_loc;
@@ -208,7 +206,6 @@ let extension_descr path_ext ext =
208206
cstr_consts = -1;
209207
cstr_nonconsts = -1;
210208
cstr_private = ext.ext_private;
211-
cstr_normal = -1;
212209
cstr_generalized = ext.ext_ret_type <> None;
213210
cstr_loc = ext.ext_loc;
214211
cstr_attributes = ext.ext_attributes;

compiler/ml/env.ml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ let prefixed_sg = Hashtbl.create 113
5757
type error =
5858
| Illegal_renaming of string * string * string
5959
| Inconsistent_import of string * string * string
60-
| Need_recursive_types of string * string
6160
| Missing_module of Location.t * Path.t * Path.t
6261
| Illegal_value_name of Location.t * string
6362

@@ -147,8 +146,6 @@ type summary =
147146
| Env_extension of summary * Ident.t * extension_constructor
148147
| Env_module of summary * Ident.t * module_declaration
149148
| Env_modtype of summary * Ident.t * modtype_declaration
150-
| Env_class of unit
151-
| Env_cltype of unit
152149
| Env_open of summary * Path.t
153150
| Env_functor_arg of summary * Ident.t
154151
| Env_constraints of summary * type_declaration PathMap.t
@@ -732,8 +729,6 @@ let check_pers_struct name =
732729
" %a@ contains the compiled interface for @ %s when %s was expected"
733730
Location.print_filename filename ps_name name
734731
| Inconsistent_import _ -> assert false
735-
| Need_recursive_types (name, _) ->
736-
Format.sprintf "%s uses recursive types" name
737732
| Missing_module _ -> assert false
738733
| Illegal_value_name _ -> assert false
739734
in
@@ -2129,10 +2124,6 @@ let report_error ppf = function
21292124
"@[<hov>The files %a@ and %a@ make inconsistent assumptions@ over \
21302125
interface %s@]"
21312126
Location.print_filename source1 Location.print_filename source2 name
2132-
| Need_recursive_types (import, export) ->
2133-
fprintf ppf
2134-
"@[<hov>Unit %s imports from %s, which uses recursive types.@ %s@]" export
2135-
import "The compilation flag -rectypes is required"
21362127
| Missing_module (_, path1, path2) ->
21372128
fprintf ppf "@[@[<hov>";
21382129
if Path.same path1 path2 then

compiler/ml/env.mli

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ type summary =
2727
| Env_extension of summary * Ident.t * extension_constructor
2828
| Env_module of summary * Ident.t * module_declaration
2929
| Env_modtype of summary * Ident.t * modtype_declaration
30-
| Env_class of unit
31-
| Env_cltype of unit
3230
| Env_open of summary * Path.t
3331
| Env_functor_arg of summary * Ident.t
3432
| Env_constraints of summary * type_declaration PathMap.t
@@ -239,7 +237,6 @@ val env_of_only_summary : (summary -> Subst.t -> t) -> t -> t
239237
type error =
240238
| Illegal_renaming of string * string * string
241239
| Inconsistent_import of string * string * string
242-
| Need_recursive_types of string * string
243240
| Missing_module of Location.t * Path.t * Path.t
244241
| Illegal_value_name of Location.t * string
245242

compiler/ml/error_message_utils.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ type type_clash_statement = FunctionCall
55
type type_clash_context =
66
| SetRecordField
77
| ArrayValue
8-
| FunctionReturn
98
| MaybeUnwrapOption
109
| IfCondition
1110
| IfReturn
@@ -53,8 +52,6 @@ let error_expected_type_text ppf type_clash_context =
5352
fprintf ppf
5453
"But it's being used with the @{<info>%s@} operator, which works on:"
5554
operator
56-
| Some FunctionReturn ->
57-
fprintf ppf "But this function is expecting you to return:"
5855
| Some StringConcat -> fprintf ppf "But string concatenation is expecting:"
5956
| _ -> fprintf ppf "But it's expected to have type:"
6057

0 commit comments

Comments
 (0)