Skip to content

Commit 1338ea2

Browse files
authored
AST: Remove Pstr_class (#7242)
* Remove Pstr_class * Remove Psig_class * Remove Pstr_class_type * Remove Psig_class_type * Remove Tstr_class, Tstr_class_type, Tsig_class & Tsig_class_type * Add changelog entry * Remove unit in Texp_coerce * Remove row_bound in row_desc
1 parent c2ad39e commit 1338ea2

34 files changed

+19
-133
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- AST cleanup: Remove `@res.async` attribute from the internal representation, and add a flag to untyped and typed ASTs instead. https://github.com/rescript-lang/rescript/pull/7234
2727
- AST cleanup: Remove `expression_desc.Pexp_new`, `expression_desc.Pexp_setinstvar`, `expression_desc.Pexp_override`, `expression_desc.Pexp_poly`, `exp_extra.Texp_poly`, `expression_desc.Texp_new`, `expression_desc.Texp_setinstvar`, `expression_desc.Texp_override` & `expression_desc.Texp_instvar` from AST as it is unused. https://github.com/rescript-lang/rescript/pull/7239
2828
- AST cleanup: Remove `@res.partial` attribute from the internal representation, and add a flag to untyped and typed ASTs instead. https://github.com/rescript-lang/rescript/pull/7238 https://github.com/rescript-lang/rescript/pull/7240
29+
- AST cleanup: Remove `structure_item_desc.Pstr_class`, `signature_item_desc.Psig_class`, `structure_item_desc.Pstr_class_type`, `signature_item_desc.Psig_class_type`, `structure_item_desc.Tstr_class`, `structure_item_desc.Tstr_class_type`, `signature_item_desc.Tsig_class`, `signature_item_desc.Tsig_class_type` from AST as it is unused. https://github.com/rescript-lang/rescript/pull/7242
2930

3031
# 12.0.0-alpha.7
3132

analysis/reanalyze/src/Annotation.ml

-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ let rec getAttributePayload checkText (attributes : Typedtree.attributes) =
6363
| PStr ({pstr_desc = Pstr_recmodule _} :: _) -> Some UnrecognizedPayload
6464
| PStr ({pstr_desc = Pstr_modtype _} :: _) -> Some UnrecognizedPayload
6565
| PStr ({pstr_desc = Pstr_open _} :: _) -> Some UnrecognizedPayload
66-
| PStr ({pstr_desc = Pstr_class _} :: _) -> Some UnrecognizedPayload
67-
| PStr ({pstr_desc = Pstr_class_type _} :: _) -> Some UnrecognizedPayload
6866
| PStr ({pstr_desc = Pstr_include _} :: _) -> Some UnrecognizedPayload
6967
| PStr ({pstr_desc = Pstr_attribute _} :: _) -> Some UnrecognizedPayload
7068
| PPat _ -> Some UnrecognizedPayload

compiler/core/js_implementation.ml

+1-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ let all_module_alias (ast : Parsetree.structure) =
9696
| Pstr_attribute _ -> true
9797
| Pstr_eval _ | Pstr_value _ | Pstr_primitive _ | Pstr_type _
9898
| Pstr_typext _ | Pstr_exception _ | Pstr_module _ | Pstr_recmodule _
99-
| Pstr_modtype _ | Pstr_open _ | Pstr_class _ | Pstr_class_type _
100-
| Pstr_include _ | Pstr_extension _ ->
99+
| Pstr_modtype _ | Pstr_open _ | Pstr_include _ | Pstr_extension _ ->
101100
false)
102101

103102
let no_export (rest : Parsetree.structure) : Parsetree.structure =

compiler/frontend/bs_ast_invariant.ml

-3
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ let emit_external_warnings : iterator =
8686
[{ptype_kind = Ptype_variant ({pcd_res = Some _} :: _)}] ) ->
8787
Location.raise_errorf ~loc:str_item.pstr_loc
8888
"GADT has to be recursive types, please try `type rec'"
89-
| Pstr_class _ ->
90-
Location.raise_errorf ~loc:str_item.pstr_loc
91-
"OCaml style classes are not supported"
9289
| _ -> super.structure_item self str_item);
9390
expr =
9491
(fun self ({pexp_loc = loc} as a) ->

compiler/frontend/bs_ast_mapper.ml

-4
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,6 @@ module MT = struct
232232
| Psig_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
233233
| Psig_open x -> open_ ~loc (sub.open_description sub x)
234234
| Psig_include x -> include_ ~loc (sub.include_description sub x)
235-
| Psig_class () -> assert false
236-
| Psig_class_type () -> assert false
237235
| Psig_extension (x, attrs) ->
238236
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)
239237
| Psig_attribute x -> attribute ~loc (sub.attribute sub x)
@@ -287,8 +285,6 @@ module M = struct
287285
| Pstr_recmodule l -> rec_module ~loc (List.map (sub.module_binding sub) l)
288286
| Pstr_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
289287
| Pstr_open x -> open_ ~loc (sub.open_description sub x)
290-
| Pstr_class () -> {pstr_loc = loc; pstr_desc = Pstr_class ()}
291-
| Pstr_class_type () -> {pstr_loc = loc; pstr_desc = Pstr_class_type ()}
292288
| Pstr_include x -> include_ ~loc (sub.include_declaration sub x)
293289
| Pstr_extension (x, attrs) ->
294290
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)

compiler/gentype/Annotation.ml

+2-6
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ let rec get_attribute_payload check_text (attributes : Typedtree.attributes) =
8383
| PStr ({pstr_desc = Pstr_recmodule _} :: _) -> Some UnrecognizedPayload
8484
| PStr ({pstr_desc = Pstr_modtype _} :: _) -> Some UnrecognizedPayload
8585
| PStr ({pstr_desc = Pstr_open _} :: _) -> Some UnrecognizedPayload
86-
| PStr ({pstr_desc = Pstr_class _} :: _) -> Some UnrecognizedPayload
87-
| PStr ({pstr_desc = Pstr_class_type _} :: _) -> Some UnrecognizedPayload
8886
| PStr ({pstr_desc = Pstr_include _} :: _) -> Some UnrecognizedPayload
8987
| PStr ({pstr_desc = Pstr_attribute _} :: _) -> Some UnrecognizedPayload
9088
| PPat _ -> Some UnrecognizedPayload
@@ -224,7 +222,7 @@ and signature_item_check_annotation ~check_annotation
224222
module_type_declaration
225223
|> module_type_declaration_check_annotation ~check_annotation
226224
| Tsig_typext _ | Tsig_exception _ | Tsig_recmodule _ | Tsig_open _
227-
| Tsig_include _ | Tsig_class _ | Tsig_class_type _ ->
225+
| Tsig_include _ ->
228226
false
229227

230228
and signature_check_annotation ~check_annotation
@@ -260,9 +258,7 @@ let rec structure_item_check_annotation ~check_annotation
260258
|> module_type_declaration_check_annotation ~check_annotation
261259
| Tstr_attribute attribute ->
262260
[attribute] |> check_annotation ~loc:structure_item.str_loc
263-
| Tstr_eval _ | Tstr_typext _ | Tstr_exception _ | Tstr_open _ | Tstr_class _
264-
| Tstr_class_type _ ->
265-
false
261+
| Tstr_eval _ | Tstr_typext _ | Tstr_exception _ | Tstr_open _ -> false
266262

267263
and module_expr_check_annotation ~check_annotation
268264
(module_expr : Typedtree.module_expr) =

compiler/gentype/TranslateSignature.ml

-6
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,6 @@ and translate_signature_item ~config ~output_file_relative ~resolver ~type_env
156156
| {Typedtree.sig_desc = Typedtree.Tsig_include _} ->
157157
log_not_implemented ("Tsig_include " ^ __LOC__);
158158
Translation.empty
159-
| {Typedtree.sig_desc = Typedtree.Tsig_class _} ->
160-
log_not_implemented ("Tsig_class " ^ __LOC__);
161-
Translation.empty
162-
| {Typedtree.sig_desc = Typedtree.Tsig_class_type _} ->
163-
log_not_implemented ("Tsig_class_type " ^ __LOC__);
164-
Translation.empty
165159
| {Typedtree.sig_desc = Typedtree.Tsig_attribute _} ->
166160
log_not_implemented ("Tsig_attribute " ^ __LOC__);
167161
Translation.empty

compiler/gentype/TranslateStructure.ml

-6
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,6 @@ and translate_structure_item ~config ~output_file_relative ~resolver ~type_env
352352
| {str_desc = Tstr_open _} ->
353353
log_not_implemented ("Tstr_open " ^ __LOC__);
354354
Translation.empty
355-
| {str_desc = Tstr_class _} ->
356-
log_not_implemented ("Tstr_class " ^ __LOC__);
357-
Translation.empty
358-
| {str_desc = Tstr_class_type _} ->
359-
log_not_implemented ("Tstr_class_type " ^ __LOC__);
360-
Translation.empty
361355
| {str_desc = Tstr_attribute _} ->
362356
log_not_implemented ("Tstr_attribute " ^ __LOC__);
363357
Translation.empty

compiler/ml/ast_iterator.ml

-4
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,6 @@ module MT = struct
216216
| Psig_modtype x -> sub.module_type_declaration sub x
217217
| Psig_open x -> sub.open_description sub x
218218
| Psig_include x -> sub.include_description sub x
219-
| Psig_class () -> ()
220-
| Psig_class_type () -> ()
221219
| Psig_extension (x, attrs) ->
222220
sub.extension sub x;
223221
sub.attributes sub attrs
@@ -261,8 +259,6 @@ module M = struct
261259
| Pstr_recmodule l -> List.iter (sub.module_binding sub) l
262260
| Pstr_modtype x -> sub.module_type_declaration sub x
263261
| Pstr_open x -> sub.open_description sub x
264-
| Pstr_class () -> ()
265-
| Pstr_class_type () -> ()
266262
| Pstr_include x -> sub.include_declaration sub x
267263
| Pstr_extension (x, attrs) ->
268264
sub.extension sub x;

compiler/ml/ast_mapper.ml

-4
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@ module MT = struct
215215
| Psig_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
216216
| Psig_open x -> open_ ~loc (sub.open_description sub x)
217217
| Psig_include x -> include_ ~loc (sub.include_description sub x)
218-
| Psig_class _ -> assert false
219-
| Psig_class_type _ -> assert false
220218
| Psig_extension (x, attrs) ->
221219
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)
222220
| Psig_attribute x -> attribute ~loc (sub.attribute sub x)
@@ -258,8 +256,6 @@ module M = struct
258256
| Pstr_recmodule l -> rec_module ~loc (List.map (sub.module_binding sub) l)
259257
| Pstr_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
260258
| Pstr_open x -> open_ ~loc (sub.open_description sub x)
261-
| Pstr_class () -> {pstr_loc = loc; pstr_desc = Pstr_class ()}
262-
| Pstr_class_type () -> {pstr_loc = loc; pstr_desc = Pstr_class_type ()}
263259
| Pstr_include x -> include_ ~loc (sub.include_declaration sub x)
264260
| Pstr_extension (x, attrs) ->
265261
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)

compiler/ml/ast_mapper_from0.ml

+3-2
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,9 @@ module M = struct
283283
| Pstr_recmodule l -> rec_module ~loc (List.map (sub.module_binding sub) l)
284284
| Pstr_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
285285
| Pstr_open x -> open_ ~loc (sub.open_description sub x)
286-
| Pstr_class () -> {pstr_loc = loc; pstr_desc = Pstr_class ()}
287-
| Pstr_class_type () -> {pstr_loc = loc; pstr_desc = Pstr_class_type ()}
286+
| Pstr_class () -> failwith "Pstr_class is no longer present in ReScript"
287+
| Pstr_class_type () ->
288+
failwith "Pstr_class_type is no longer present in ReScript"
288289
| Pstr_include x -> include_ ~loc (sub.include_declaration sub x)
289290
| Pstr_extension (x, attrs) ->
290291
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)

compiler/ml/ast_mapper_to0.ml

-4
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,6 @@ module MT = struct
232232
| Psig_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
233233
| Psig_open x -> open_ ~loc (sub.open_description sub x)
234234
| Psig_include x -> include_ ~loc (sub.include_description sub x)
235-
| Psig_class _ -> assert false
236-
| Psig_class_type _ -> assert false
237235
| Psig_extension (x, attrs) ->
238236
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)
239237
| Psig_attribute x -> attribute ~loc (sub.attribute sub x)
@@ -275,8 +273,6 @@ module M = struct
275273
| Pstr_recmodule l -> rec_module ~loc (List.map (sub.module_binding sub) l)
276274
| Pstr_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
277275
| Pstr_open x -> open_ ~loc (sub.open_description sub x)
278-
| Pstr_class () -> {pstr_loc = loc; pstr_desc = Pstr_class ()}
279-
| Pstr_class_type () -> {pstr_loc = loc; pstr_desc = Pstr_class_type ()}
280276
| Pstr_include x -> include_ ~loc (sub.include_declaration sub x)
281277
| Pstr_extension (x, attrs) ->
282278
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)

compiler/ml/btype.ml

-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ let copy_row f fixed row keep more =
404404
{
405405
row_fields = fields;
406406
row_more = more;
407-
row_bound = ();
408407
row_fixed = row.row_fixed && fixed;
409408
row_closed = row.row_closed;
410409
row_name = name;

compiler/ml/ctype.ml

-4
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,6 @@ let rec copy ?env ?partial ?keep_names ty =
933933
{
934934
row_fields = Ext_list.filter row.row_fields not_reither;
935935
row_more = more';
936-
row_bound = ();
937936
row_closed = false;
938937
row_fixed = false;
939938
row_name = None;
@@ -1722,7 +1721,6 @@ let mkvariant fields closed =
17221721
row_fields = fields;
17231722
row_closed = closed;
17241723
row_more = newvar ();
1725-
row_bound = ();
17261724
row_fixed = false;
17271725
row_name = None;
17281726
})
@@ -2554,7 +2552,6 @@ and unify_row env row1 row2 =
25542552
{
25552553
row_fields = [];
25562554
row_more = more;
2557-
row_bound = ();
25582555
row_closed = closed;
25592556
row_fixed = fixed;
25602557
row_name = name;
@@ -3486,7 +3483,6 @@ let rec build_subtype env visited loops posi level t =
34863483
{
34873484
row_fields = List.map fst fields;
34883485
row_more = newvar ();
3489-
row_bound = ();
34903486
row_closed = posi;
34913487
row_fixed = false;
34923488
row_name = (if c > Unchanged then None else row.row_name);

compiler/ml/depend.ml

-4
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,6 @@ and add_sig_item (bv, m) item =
385385
add_names s;
386386
let add = StringMap.fold StringMap.add m' in
387387
(add bv, add m)
388-
| Psig_class () -> (bv, m)
389-
| Psig_class_type () -> (bv, m)
390388
| Psig_attribute _ -> (bv, m)
391389
| Psig_extension (e, _) ->
392390
handle_extension e;
@@ -471,8 +469,6 @@ and add_struct_item (bv, m) item : _ StringMap.t * _ StringMap.t =
471469
| Some mty -> add_modtype bv mty);
472470
(bv, m)
473471
| Pstr_open od -> (open_module bv od.popen_lid.txt, m)
474-
| Pstr_class () -> (bv, m)
475-
| Pstr_class_type () -> (bv, m)
476472
| Pstr_include incl ->
477473
let (Node (s, m')) = add_module_binding bv incl.pincl_mod in
478474
add_names s;

compiler/ml/parsetree.ml

-4
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,6 @@ and signature_item_desc =
476476
module type S *)
477477
| Psig_open of open_description (* open X *)
478478
| Psig_include of include_description (* include MT *)
479-
| Psig_class of unit (* Dummy AST node *)
480-
| Psig_class_type of unit (* Dummy AST node *)
481479
| Psig_attribute of attribute (* [@@@id] *)
482480
| Psig_extension of extension * attributes
483481
(* [%%id] *)
@@ -578,8 +576,6 @@ and structure_item_desc =
578576
(* module rec X1 = ME1 and ... and Xn = MEn *)
579577
| Pstr_modtype of module_type_declaration (* module type S = MT *)
580578
| Pstr_open of open_description (* open X *)
581-
| Pstr_class of unit (* Dummy AST node *)
582-
| Pstr_class_type of unit (* Dummy AST node *)
583579
| Pstr_include of include_declaration (* include ME *)
584580
| Pstr_attribute of attribute (* [@@@id] *)
585581
| Pstr_extension of extension * attributes

compiler/ml/pprintast.ml

-4
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,6 @@ and signature_item ctxt f x : unit =
883883
(value_description ctxt) vd (item_attributes ctxt) vd.pval_attributes
884884
| Psig_typext te -> type_extension ctxt f te
885885
| Psig_exception ed -> exception_declaration ctxt f ed
886-
| Psig_class () -> ()
887886
| Psig_module
888887
({pmd_type = {pmty_desc = Pmty_alias alias; pmty_attributes = []; _}; _}
889888
as pmd) ->
@@ -908,7 +907,6 @@ and signature_item ctxt f x : unit =
908907
pp_print_space f ();
909908
pp f "@ =@ %a" (module_type ctxt) mt)
910909
md (item_attributes ctxt) attrs
911-
| Psig_class_type () -> ()
912910
| Psig_recmodule decls ->
913911
let rec string_x_module_type_list f ?(first = true) l =
914912
match l with
@@ -1115,8 +1113,6 @@ and structure_item ctxt f x =
11151113
pp_print_space f ();
11161114
pp f "@ =@ %a" (module_type ctxt) mt)
11171115
md (item_attributes ctxt) attrs
1118-
| Pstr_class () -> ()
1119-
| Pstr_class_type () -> ()
11201116
| Pstr_primitive vd ->
11211117
pp f "@[<hov2>external@ %a@ :@ %a@]%a" protect_ident vd.pval_name.txt
11221118
(value_description ctxt) vd (item_attributes ctxt) vd.pval_attributes

compiler/ml/printast.ml

-4
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,6 @@ and signature_item i ppf x =
490490
line i ppf "Psig_include\n";
491491
module_type i ppf incl.pincl_mod;
492492
attributes i ppf incl.pincl_attributes
493-
| Psig_class () -> ()
494-
| Psig_class_type () -> ()
495493
| Psig_extension ((s, arg), attrs) ->
496494
line i ppf "Psig_extension \"%s\"\n" s.txt;
497495
attributes i ppf attrs;
@@ -586,8 +584,6 @@ and structure_item i ppf x =
586584
line i ppf "Pstr_open %a %a\n" fmt_override_flag od.popen_override
587585
fmt_longident_loc od.popen_lid;
588586
attributes i ppf od.popen_attributes
589-
| Pstr_class () -> ()
590-
| Pstr_class_type () -> ()
591587
| Pstr_include incl ->
592588
line i ppf "Pstr_include";
593589
attributes i ppf incl.pincl_attributes;

compiler/ml/printtyped.ml

+1-5
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ and expression_extra i ppf x attrs =
252252
line i ppf "Texp_constraint\n";
253253
attributes i ppf attrs;
254254
core_type i ppf ct
255-
| Texp_coerce ((), cto2) ->
255+
| Texp_coerce cto2 ->
256256
line i ppf "Texp_coerce\n";
257257
attributes i ppf attrs;
258258
core_type i ppf cto2
@@ -499,8 +499,6 @@ and signature_item i ppf x =
499499
line i ppf "Tsig_include\n";
500500
attributes i ppf incl.incl_attributes;
501501
module_type i ppf incl.incl_mod
502-
| Tsig_class () -> ()
503-
| Tsig_class_type () -> ()
504502
| Tsig_attribute (s, arg) ->
505503
line i ppf "Tsig_attribute \"%s\"\n" s.txt;
506504
Printast.payload i ppf arg
@@ -595,8 +593,6 @@ and structure_item i ppf x =
595593
line i ppf "Tstr_open %a %a\n" fmt_override_flag od.open_override fmt_path
596594
od.open_path;
597595
attributes i ppf od.open_attributes
598-
| Tstr_class () -> ()
599-
| Tstr_class_type () -> ()
600596
| Tstr_include incl ->
601597
line i ppf "Tstr_include";
602598
attributes i ppf incl.incl_attributes;

compiler/ml/rec_check.ml

-2
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,6 @@ and structure_item : Env.env -> Typedtree.structure_item -> Env.env * Use.t =
356356
| Tstr_exception _ -> (Env.empty, Use.empty)
357357
| Tstr_modtype _ -> (Env.empty, Use.empty)
358358
| Tstr_open _ -> (Env.empty, Use.empty)
359-
| Tstr_class () -> (Env.empty, Use.empty)
360-
| Tstr_class_type _ -> (Env.empty, Use.empty)
361359
| Tstr_include inc ->
362360
(* This is a kind of projection. There's no need to add
363361
anything to the environment because everything is used in

compiler/ml/tast_iterator.ml

+1-5
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ let structure_item sub {str_desc; str_env; _} =
6969
| Tstr_module mb -> sub.module_binding sub mb
7070
| Tstr_recmodule list -> List.iter (sub.module_binding sub) list
7171
| Tstr_modtype x -> sub.module_type_declaration sub x
72-
| Tstr_class _ -> ()
73-
| Tstr_class_type () -> ()
7472
| Tstr_include incl -> include_infos (sub.module_expr sub) incl
7573
| Tstr_open _ -> ()
7674
| Tstr_attribute _ -> ()
@@ -142,7 +140,7 @@ let pat sub {pat_extra; pat_desc; pat_env; _} =
142140
let expr sub {exp_extra; exp_desc; exp_env; _} =
143141
let extra = function
144142
| Texp_constraint cty -> sub.typ sub cty
145-
| Texp_coerce ((), cty2) -> sub.typ sub cty2
143+
| Texp_coerce cty2 -> sub.typ sub cty2
146144
| Texp_newtype _ -> ()
147145
| Texp_open (_, _, _, _) -> ()
148146
in
@@ -226,8 +224,6 @@ let signature_item sub {sig_desc; sig_env; _} =
226224
| Tsig_recmodule list -> List.iter (sub.module_declaration sub) list
227225
| Tsig_modtype x -> sub.module_type_declaration sub x
228226
| Tsig_include incl -> include_infos (sub.module_type sub) incl
229-
| Tsig_class () -> ()
230-
| Tsig_class_type () -> ()
231227
| Tsig_open _od -> ()
232228
| Tsig_attribute _ -> ()
233229

compiler/ml/tast_mapper.ml

+2-6
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ let structure_item sub {str_desc; str_loc; str_env} =
9999
| Tstr_recmodule list ->
100100
Tstr_recmodule (List.map (sub.module_binding sub) list)
101101
| Tstr_modtype x -> Tstr_modtype (sub.module_type_declaration sub x)
102-
| Tstr_class () -> Tstr_class ()
103-
| Tstr_class_type () -> Tstr_class_type ()
104102
| Tstr_include incl ->
105103
Tstr_include (include_infos (sub.module_expr sub) incl)
106104
| (Tstr_open _ | Tstr_attribute _) as d -> d
@@ -185,7 +183,7 @@ let pat sub x =
185183
let expr sub x =
186184
let extra = function
187185
| Texp_constraint cty -> Texp_constraint (sub.typ sub cty)
188-
| Texp_coerce ((), cty2) -> Texp_coerce ((), sub.typ sub cty2)
186+
| Texp_coerce cty2 -> Texp_coerce (sub.typ sub cty2)
189187
| Texp_open (ovf, path, loc, env) ->
190188
Texp_open (ovf, path, loc, sub.env sub env)
191189
| Texp_newtype _ as d -> d
@@ -283,9 +281,7 @@ let signature_item sub x =
283281
| Tsig_modtype x -> Tsig_modtype (sub.module_type_declaration sub x)
284282
| Tsig_include incl ->
285283
Tsig_include (include_infos (sub.module_type sub) incl)
286-
| (Tsig_class_type _ | Tsig_class _ | Tsig_open _ | Tsig_attribute _) as d
287-
->
288-
d
284+
| (Tsig_open _ | Tsig_attribute _) as d -> d
289285
in
290286
{x with sig_desc; sig_env}
291287

compiler/ml/translmod.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ and transl_structure loc fields cc rootpath final_env = function
474474
transl_module Tcoerce_none None modl,
475475
body ),
476476
size )
477-
| Tstr_class _ | Tstr_primitive _ | Tstr_type _ | Tstr_modtype _
478-
| Tstr_open _ | Tstr_class_type _ | Tstr_attribute _ ->
477+
| Tstr_primitive _ | Tstr_type _ | Tstr_modtype _ | Tstr_open _
478+
| Tstr_attribute _ ->
479479
transl_structure loc fields cc rootpath final_env rem)
480480

481481
(* Update forward declaration in Translcore *)

0 commit comments

Comments
 (0)