Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AST: Remove Pstr_class #7242

Merged
merged 8 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- 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
- 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
- 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
- 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

# 12.0.0-alpha.7

Expand Down
2 changes: 0 additions & 2 deletions analysis/reanalyze/src/Annotation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ let rec getAttributePayload checkText (attributes : Typedtree.attributes) =
| PStr ({pstr_desc = Pstr_recmodule _} :: _) -> Some UnrecognizedPayload
| PStr ({pstr_desc = Pstr_modtype _} :: _) -> Some UnrecognizedPayload
| PStr ({pstr_desc = Pstr_open _} :: _) -> Some UnrecognizedPayload
| PStr ({pstr_desc = Pstr_class _} :: _) -> Some UnrecognizedPayload
| PStr ({pstr_desc = Pstr_class_type _} :: _) -> Some UnrecognizedPayload
| PStr ({pstr_desc = Pstr_include _} :: _) -> Some UnrecognizedPayload
| PStr ({pstr_desc = Pstr_attribute _} :: _) -> Some UnrecognizedPayload
| PPat _ -> Some UnrecognizedPayload
Expand Down
3 changes: 1 addition & 2 deletions compiler/core/js_implementation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ let all_module_alias (ast : Parsetree.structure) =
| Pstr_attribute _ -> true
| Pstr_eval _ | Pstr_value _ | Pstr_primitive _ | Pstr_type _
| Pstr_typext _ | Pstr_exception _ | Pstr_module _ | Pstr_recmodule _
| Pstr_modtype _ | Pstr_open _ | Pstr_class _ | Pstr_class_type _
| Pstr_include _ | Pstr_extension _ ->
| Pstr_modtype _ | Pstr_open _ | Pstr_include _ | Pstr_extension _ ->
false)

let no_export (rest : Parsetree.structure) : Parsetree.structure =
Expand Down
3 changes: 0 additions & 3 deletions compiler/frontend/bs_ast_invariant.ml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ let emit_external_warnings : iterator =
[{ptype_kind = Ptype_variant ({pcd_res = Some _} :: _)}] ) ->
Location.raise_errorf ~loc:str_item.pstr_loc
"GADT has to be recursive types, please try `type rec'"
| Pstr_class _ ->
Location.raise_errorf ~loc:str_item.pstr_loc
"OCaml style classes are not supported"
| _ -> super.structure_item self str_item);
expr =
(fun self ({pexp_loc = loc} as a) ->
Expand Down
4 changes: 0 additions & 4 deletions compiler/frontend/bs_ast_mapper.ml
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ module MT = struct
| Psig_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
| Psig_open x -> open_ ~loc (sub.open_description sub x)
| Psig_include x -> include_ ~loc (sub.include_description sub x)
| Psig_class () -> assert false
| Psig_class_type () -> assert false
| Psig_extension (x, attrs) ->
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)
| Psig_attribute x -> attribute ~loc (sub.attribute sub x)
Expand Down Expand Up @@ -287,8 +285,6 @@ module M = struct
| Pstr_recmodule l -> rec_module ~loc (List.map (sub.module_binding sub) l)
| Pstr_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
| Pstr_open x -> open_ ~loc (sub.open_description sub x)
| Pstr_class () -> {pstr_loc = loc; pstr_desc = Pstr_class ()}
| Pstr_class_type () -> {pstr_loc = loc; pstr_desc = Pstr_class_type ()}
| Pstr_include x -> include_ ~loc (sub.include_declaration sub x)
| Pstr_extension (x, attrs) ->
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)
Expand Down
8 changes: 2 additions & 6 deletions compiler/gentype/Annotation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ let rec get_attribute_payload check_text (attributes : Typedtree.attributes) =
| PStr ({pstr_desc = Pstr_recmodule _} :: _) -> Some UnrecognizedPayload
| PStr ({pstr_desc = Pstr_modtype _} :: _) -> Some UnrecognizedPayload
| PStr ({pstr_desc = Pstr_open _} :: _) -> Some UnrecognizedPayload
| PStr ({pstr_desc = Pstr_class _} :: _) -> Some UnrecognizedPayload
| PStr ({pstr_desc = Pstr_class_type _} :: _) -> Some UnrecognizedPayload
| PStr ({pstr_desc = Pstr_include _} :: _) -> Some UnrecognizedPayload
| PStr ({pstr_desc = Pstr_attribute _} :: _) -> Some UnrecognizedPayload
| PPat _ -> Some UnrecognizedPayload
Expand Down Expand Up @@ -224,7 +222,7 @@ and signature_item_check_annotation ~check_annotation
module_type_declaration
|> module_type_declaration_check_annotation ~check_annotation
| Tsig_typext _ | Tsig_exception _ | Tsig_recmodule _ | Tsig_open _
| Tsig_include _ | Tsig_class _ | Tsig_class_type _ ->
| Tsig_include _ ->
false

and signature_check_annotation ~check_annotation
Expand Down Expand Up @@ -260,9 +258,7 @@ let rec structure_item_check_annotation ~check_annotation
|> module_type_declaration_check_annotation ~check_annotation
| Tstr_attribute attribute ->
[attribute] |> check_annotation ~loc:structure_item.str_loc
| Tstr_eval _ | Tstr_typext _ | Tstr_exception _ | Tstr_open _ | Tstr_class _
| Tstr_class_type _ ->
false
| Tstr_eval _ | Tstr_typext _ | Tstr_exception _ | Tstr_open _ -> false

and module_expr_check_annotation ~check_annotation
(module_expr : Typedtree.module_expr) =
Expand Down
6 changes: 0 additions & 6 deletions compiler/gentype/TranslateSignature.ml
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,6 @@ and translate_signature_item ~config ~output_file_relative ~resolver ~type_env
| {Typedtree.sig_desc = Typedtree.Tsig_include _} ->
log_not_implemented ("Tsig_include " ^ __LOC__);
Translation.empty
| {Typedtree.sig_desc = Typedtree.Tsig_class _} ->
log_not_implemented ("Tsig_class " ^ __LOC__);
Translation.empty
| {Typedtree.sig_desc = Typedtree.Tsig_class_type _} ->
log_not_implemented ("Tsig_class_type " ^ __LOC__);
Translation.empty
| {Typedtree.sig_desc = Typedtree.Tsig_attribute _} ->
log_not_implemented ("Tsig_attribute " ^ __LOC__);
Translation.empty
Expand Down
6 changes: 0 additions & 6 deletions compiler/gentype/TranslateStructure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,6 @@ and translate_structure_item ~config ~output_file_relative ~resolver ~type_env
| {str_desc = Tstr_open _} ->
log_not_implemented ("Tstr_open " ^ __LOC__);
Translation.empty
| {str_desc = Tstr_class _} ->
log_not_implemented ("Tstr_class " ^ __LOC__);
Translation.empty
| {str_desc = Tstr_class_type _} ->
log_not_implemented ("Tstr_class_type " ^ __LOC__);
Translation.empty
| {str_desc = Tstr_attribute _} ->
log_not_implemented ("Tstr_attribute " ^ __LOC__);
Translation.empty
Expand Down
4 changes: 0 additions & 4 deletions compiler/ml/ast_iterator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ module MT = struct
| Psig_modtype x -> sub.module_type_declaration sub x
| Psig_open x -> sub.open_description sub x
| Psig_include x -> sub.include_description sub x
| Psig_class () -> ()
| Psig_class_type () -> ()
| Psig_extension (x, attrs) ->
sub.extension sub x;
sub.attributes sub attrs
Expand Down Expand Up @@ -261,8 +259,6 @@ module M = struct
| Pstr_recmodule l -> List.iter (sub.module_binding sub) l
| Pstr_modtype x -> sub.module_type_declaration sub x
| Pstr_open x -> sub.open_description sub x
| Pstr_class () -> ()
| Pstr_class_type () -> ()
| Pstr_include x -> sub.include_declaration sub x
| Pstr_extension (x, attrs) ->
sub.extension sub x;
Expand Down
4 changes: 0 additions & 4 deletions compiler/ml/ast_mapper.ml
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@ module MT = struct
| Psig_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
| Psig_open x -> open_ ~loc (sub.open_description sub x)
| Psig_include x -> include_ ~loc (sub.include_description sub x)
| Psig_class _ -> assert false
| Psig_class_type _ -> assert false
| Psig_extension (x, attrs) ->
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)
| Psig_attribute x -> attribute ~loc (sub.attribute sub x)
Expand Down Expand Up @@ -258,8 +256,6 @@ module M = struct
| Pstr_recmodule l -> rec_module ~loc (List.map (sub.module_binding sub) l)
| Pstr_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
| Pstr_open x -> open_ ~loc (sub.open_description sub x)
| Pstr_class () -> {pstr_loc = loc; pstr_desc = Pstr_class ()}
| Pstr_class_type () -> {pstr_loc = loc; pstr_desc = Pstr_class_type ()}
| Pstr_include x -> include_ ~loc (sub.include_declaration sub x)
| Pstr_extension (x, attrs) ->
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)
Expand Down
5 changes: 3 additions & 2 deletions compiler/ml/ast_mapper_from0.ml
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,9 @@ module M = struct
| Pstr_recmodule l -> rec_module ~loc (List.map (sub.module_binding sub) l)
| Pstr_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
| Pstr_open x -> open_ ~loc (sub.open_description sub x)
| Pstr_class () -> {pstr_loc = loc; pstr_desc = Pstr_class ()}
| Pstr_class_type () -> {pstr_loc = loc; pstr_desc = Pstr_class_type ()}
| Pstr_class () -> failwith "Pstr_class is no longer present in ReScript"
| Pstr_class_type () ->
failwith "Pstr_class_type is no longer present in ReScript"
| Pstr_include x -> include_ ~loc (sub.include_declaration sub x)
| Pstr_extension (x, attrs) ->
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)
Expand Down
4 changes: 0 additions & 4 deletions compiler/ml/ast_mapper_to0.ml
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ module MT = struct
| Psig_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
| Psig_open x -> open_ ~loc (sub.open_description sub x)
| Psig_include x -> include_ ~loc (sub.include_description sub x)
| Psig_class _ -> assert false
| Psig_class_type _ -> assert false
| Psig_extension (x, attrs) ->
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)
| Psig_attribute x -> attribute ~loc (sub.attribute sub x)
Expand Down Expand Up @@ -275,8 +273,6 @@ module M = struct
| Pstr_recmodule l -> rec_module ~loc (List.map (sub.module_binding sub) l)
| Pstr_modtype x -> modtype ~loc (sub.module_type_declaration sub x)
| Pstr_open x -> open_ ~loc (sub.open_description sub x)
| Pstr_class () -> {pstr_loc = loc; pstr_desc = Pstr_class ()}
| Pstr_class_type () -> {pstr_loc = loc; pstr_desc = Pstr_class_type ()}
| Pstr_include x -> include_ ~loc (sub.include_declaration sub x)
| Pstr_extension (x, attrs) ->
extension ~loc (sub.extension sub x) ~attrs:(sub.attributes sub attrs)
Expand Down
1 change: 0 additions & 1 deletion compiler/ml/btype.ml
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ let copy_row f fixed row keep more =
{
row_fields = fields;
row_more = more;
row_bound = ();
row_fixed = row.row_fixed && fixed;
row_closed = row.row_closed;
row_name = name;
Expand Down
4 changes: 0 additions & 4 deletions compiler/ml/ctype.ml
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,6 @@ let rec copy ?env ?partial ?keep_names ty =
{
row_fields = Ext_list.filter row.row_fields not_reither;
row_more = more';
row_bound = ();
row_closed = false;
row_fixed = false;
row_name = None;
Expand Down Expand Up @@ -1722,7 +1721,6 @@ let mkvariant fields closed =
row_fields = fields;
row_closed = closed;
row_more = newvar ();
row_bound = ();
row_fixed = false;
row_name = None;
})
Expand Down Expand Up @@ -2554,7 +2552,6 @@ and unify_row env row1 row2 =
{
row_fields = [];
row_more = more;
row_bound = ();
row_closed = closed;
row_fixed = fixed;
row_name = name;
Expand Down Expand Up @@ -3486,7 +3483,6 @@ let rec build_subtype env visited loops posi level t =
{
row_fields = List.map fst fields;
row_more = newvar ();
row_bound = ();
row_closed = posi;
row_fixed = false;
row_name = (if c > Unchanged then None else row.row_name);
Expand Down
4 changes: 0 additions & 4 deletions compiler/ml/depend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,6 @@ and add_sig_item (bv, m) item =
add_names s;
let add = StringMap.fold StringMap.add m' in
(add bv, add m)
| Psig_class () -> (bv, m)
| Psig_class_type () -> (bv, m)
| Psig_attribute _ -> (bv, m)
| Psig_extension (e, _) ->
handle_extension e;
Expand Down Expand Up @@ -471,8 +469,6 @@ and add_struct_item (bv, m) item : _ StringMap.t * _ StringMap.t =
| Some mty -> add_modtype bv mty);
(bv, m)
| Pstr_open od -> (open_module bv od.popen_lid.txt, m)
| Pstr_class () -> (bv, m)
| Pstr_class_type () -> (bv, m)
| Pstr_include incl ->
let (Node (s, m')) = add_module_binding bv incl.pincl_mod in
add_names s;
Expand Down
4 changes: 0 additions & 4 deletions compiler/ml/parsetree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,6 @@ and signature_item_desc =
module type S *)
| Psig_open of open_description (* open X *)
| Psig_include of include_description (* include MT *)
| Psig_class of unit (* Dummy AST node *)
| Psig_class_type of unit (* Dummy AST node *)
| Psig_attribute of attribute (* [@@@id] *)
| Psig_extension of extension * attributes
(* [%%id] *)
Expand Down Expand Up @@ -578,8 +576,6 @@ and structure_item_desc =
(* module rec X1 = ME1 and ... and Xn = MEn *)
| Pstr_modtype of module_type_declaration (* module type S = MT *)
| Pstr_open of open_description (* open X *)
| Pstr_class of unit (* Dummy AST node *)
| Pstr_class_type of unit (* Dummy AST node *)
| Pstr_include of include_declaration (* include ME *)
| Pstr_attribute of attribute (* [@@@id] *)
| Pstr_extension of extension * attributes
Expand Down
4 changes: 0 additions & 4 deletions compiler/ml/pprintast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,6 @@ and signature_item ctxt f x : unit =
(value_description ctxt) vd (item_attributes ctxt) vd.pval_attributes
| Psig_typext te -> type_extension ctxt f te
| Psig_exception ed -> exception_declaration ctxt f ed
| Psig_class () -> ()
| Psig_module
({pmd_type = {pmty_desc = Pmty_alias alias; pmty_attributes = []; _}; _}
as pmd) ->
Expand All @@ -908,7 +907,6 @@ and signature_item ctxt f x : unit =
pp_print_space f ();
pp f "@ =@ %a" (module_type ctxt) mt)
md (item_attributes ctxt) attrs
| Psig_class_type () -> ()
| Psig_recmodule decls ->
let rec string_x_module_type_list f ?(first = true) l =
match l with
Expand Down Expand Up @@ -1115,8 +1113,6 @@ and structure_item ctxt f x =
pp_print_space f ();
pp f "@ =@ %a" (module_type ctxt) mt)
md (item_attributes ctxt) attrs
| Pstr_class () -> ()
| Pstr_class_type () -> ()
| Pstr_primitive vd ->
pp f "@[<hov2>external@ %a@ :@ %a@]%a" protect_ident vd.pval_name.txt
(value_description ctxt) vd (item_attributes ctxt) vd.pval_attributes
Expand Down
4 changes: 0 additions & 4 deletions compiler/ml/printast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,6 @@ and signature_item i ppf x =
line i ppf "Psig_include\n";
module_type i ppf incl.pincl_mod;
attributes i ppf incl.pincl_attributes
| Psig_class () -> ()
| Psig_class_type () -> ()
| Psig_extension ((s, arg), attrs) ->
line i ppf "Psig_extension \"%s\"\n" s.txt;
attributes i ppf attrs;
Expand Down Expand Up @@ -586,8 +584,6 @@ and structure_item i ppf x =
line i ppf "Pstr_open %a %a\n" fmt_override_flag od.popen_override
fmt_longident_loc od.popen_lid;
attributes i ppf od.popen_attributes
| Pstr_class () -> ()
| Pstr_class_type () -> ()
| Pstr_include incl ->
line i ppf "Pstr_include";
attributes i ppf incl.pincl_attributes;
Expand Down
6 changes: 1 addition & 5 deletions compiler/ml/printtyped.ml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ and expression_extra i ppf x attrs =
line i ppf "Texp_constraint\n";
attributes i ppf attrs;
core_type i ppf ct
| Texp_coerce ((), cto2) ->
| Texp_coerce cto2 ->
line i ppf "Texp_coerce\n";
attributes i ppf attrs;
core_type i ppf cto2
Expand Down Expand Up @@ -499,8 +499,6 @@ and signature_item i ppf x =
line i ppf "Tsig_include\n";
attributes i ppf incl.incl_attributes;
module_type i ppf incl.incl_mod
| Tsig_class () -> ()
| Tsig_class_type () -> ()
| Tsig_attribute (s, arg) ->
line i ppf "Tsig_attribute \"%s\"\n" s.txt;
Printast.payload i ppf arg
Expand Down Expand Up @@ -595,8 +593,6 @@ and structure_item i ppf x =
line i ppf "Tstr_open %a %a\n" fmt_override_flag od.open_override fmt_path
od.open_path;
attributes i ppf od.open_attributes
| Tstr_class () -> ()
| Tstr_class_type () -> ()
| Tstr_include incl ->
line i ppf "Tstr_include";
attributes i ppf incl.incl_attributes;
Expand Down
2 changes: 0 additions & 2 deletions compiler/ml/rec_check.ml
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,6 @@ and structure_item : Env.env -> Typedtree.structure_item -> Env.env * Use.t =
| Tstr_exception _ -> (Env.empty, Use.empty)
| Tstr_modtype _ -> (Env.empty, Use.empty)
| Tstr_open _ -> (Env.empty, Use.empty)
| Tstr_class () -> (Env.empty, Use.empty)
| Tstr_class_type _ -> (Env.empty, Use.empty)
| Tstr_include inc ->
(* This is a kind of projection. There's no need to add
anything to the environment because everything is used in
Expand Down
6 changes: 1 addition & 5 deletions compiler/ml/tast_iterator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ let structure_item sub {str_desc; str_env; _} =
| Tstr_module mb -> sub.module_binding sub mb
| Tstr_recmodule list -> List.iter (sub.module_binding sub) list
| Tstr_modtype x -> sub.module_type_declaration sub x
| Tstr_class _ -> ()
| Tstr_class_type () -> ()
| Tstr_include incl -> include_infos (sub.module_expr sub) incl
| Tstr_open _ -> ()
| Tstr_attribute _ -> ()
Expand Down Expand Up @@ -142,7 +140,7 @@ let pat sub {pat_extra; pat_desc; pat_env; _} =
let expr sub {exp_extra; exp_desc; exp_env; _} =
let extra = function
| Texp_constraint cty -> sub.typ sub cty
| Texp_coerce ((), cty2) -> sub.typ sub cty2
| Texp_coerce cty2 -> sub.typ sub cty2
| Texp_newtype _ -> ()
| Texp_open (_, _, _, _) -> ()
in
Expand Down Expand Up @@ -226,8 +224,6 @@ let signature_item sub {sig_desc; sig_env; _} =
| Tsig_recmodule list -> List.iter (sub.module_declaration sub) list
| Tsig_modtype x -> sub.module_type_declaration sub x
| Tsig_include incl -> include_infos (sub.module_type sub) incl
| Tsig_class () -> ()
| Tsig_class_type () -> ()
| Tsig_open _od -> ()
| Tsig_attribute _ -> ()

Expand Down
8 changes: 2 additions & 6 deletions compiler/ml/tast_mapper.ml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ let structure_item sub {str_desc; str_loc; str_env} =
| Tstr_recmodule list ->
Tstr_recmodule (List.map (sub.module_binding sub) list)
| Tstr_modtype x -> Tstr_modtype (sub.module_type_declaration sub x)
| Tstr_class () -> Tstr_class ()
| Tstr_class_type () -> Tstr_class_type ()
| Tstr_include incl ->
Tstr_include (include_infos (sub.module_expr sub) incl)
| (Tstr_open _ | Tstr_attribute _) as d -> d
Expand Down Expand Up @@ -185,7 +183,7 @@ let pat sub x =
let expr sub x =
let extra = function
| Texp_constraint cty -> Texp_constraint (sub.typ sub cty)
| Texp_coerce ((), cty2) -> Texp_coerce ((), sub.typ sub cty2)
| Texp_coerce cty2 -> Texp_coerce (sub.typ sub cty2)
| Texp_open (ovf, path, loc, env) ->
Texp_open (ovf, path, loc, sub.env sub env)
| Texp_newtype _ as d -> d
Expand Down Expand Up @@ -283,9 +281,7 @@ let signature_item sub x =
| Tsig_modtype x -> Tsig_modtype (sub.module_type_declaration sub x)
| Tsig_include incl ->
Tsig_include (include_infos (sub.module_type sub) incl)
| (Tsig_class_type _ | Tsig_class _ | Tsig_open _ | Tsig_attribute _) as d
->
d
| (Tsig_open _ | Tsig_attribute _) as d -> d
in
{x with sig_desc; sig_env}

Expand Down
4 changes: 2 additions & 2 deletions compiler/ml/translmod.ml
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ and transl_structure loc fields cc rootpath final_env = function
transl_module Tcoerce_none None modl,
body ),
size )
| Tstr_class _ | Tstr_primitive _ | Tstr_type _ | Tstr_modtype _
| Tstr_open _ | Tstr_class_type _ | Tstr_attribute _ ->
| Tstr_primitive _ | Tstr_type _ | Tstr_modtype _ | Tstr_open _
| Tstr_attribute _ ->
transl_structure loc fields cc rootpath final_env rem)

(* Update forward declaration in Translcore *)
Expand Down
Loading
Loading