diff --git a/CHANGELOG.md b/CHANGELOG.md index ae187fc1ff..e5d7b64517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/analysis/reanalyze/src/Annotation.ml b/analysis/reanalyze/src/Annotation.ml index 3e6429fb4a..ad522762dd 100644 --- a/analysis/reanalyze/src/Annotation.ml +++ b/analysis/reanalyze/src/Annotation.ml @@ -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 diff --git a/compiler/core/js_implementation.ml b/compiler/core/js_implementation.ml index 9adcf8d0d0..5f4e4e6c76 100644 --- a/compiler/core/js_implementation.ml +++ b/compiler/core/js_implementation.ml @@ -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 = diff --git a/compiler/frontend/bs_ast_invariant.ml b/compiler/frontend/bs_ast_invariant.ml index 7da08fea57..fb4bfa370b 100644 --- a/compiler/frontend/bs_ast_invariant.ml +++ b/compiler/frontend/bs_ast_invariant.ml @@ -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) -> diff --git a/compiler/frontend/bs_ast_mapper.ml b/compiler/frontend/bs_ast_mapper.ml index 292fe15b9c..dd8ca6cf75 100644 --- a/compiler/frontend/bs_ast_mapper.ml +++ b/compiler/frontend/bs_ast_mapper.ml @@ -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) @@ -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) diff --git a/compiler/gentype/Annotation.ml b/compiler/gentype/Annotation.ml index 6f1dbd1dce..9c66678b38 100644 --- a/compiler/gentype/Annotation.ml +++ b/compiler/gentype/Annotation.ml @@ -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 @@ -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 @@ -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) = diff --git a/compiler/gentype/TranslateSignature.ml b/compiler/gentype/TranslateSignature.ml index 5c3d835f7b..0033ab1edb 100644 --- a/compiler/gentype/TranslateSignature.ml +++ b/compiler/gentype/TranslateSignature.ml @@ -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 diff --git a/compiler/gentype/TranslateStructure.ml b/compiler/gentype/TranslateStructure.ml index 3def28f4a8..9a64cd34a6 100644 --- a/compiler/gentype/TranslateStructure.ml +++ b/compiler/gentype/TranslateStructure.ml @@ -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 diff --git a/compiler/ml/ast_iterator.ml b/compiler/ml/ast_iterator.ml index 2c76f6e5b4..8bae0d9154 100644 --- a/compiler/ml/ast_iterator.ml +++ b/compiler/ml/ast_iterator.ml @@ -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 @@ -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; diff --git a/compiler/ml/ast_mapper.ml b/compiler/ml/ast_mapper.ml index 854e003c99..a4d9e5b382 100644 --- a/compiler/ml/ast_mapper.ml +++ b/compiler/ml/ast_mapper.ml @@ -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) @@ -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) diff --git a/compiler/ml/ast_mapper_from0.ml b/compiler/ml/ast_mapper_from0.ml index 22d59a792f..fbb5194481 100644 --- a/compiler/ml/ast_mapper_from0.ml +++ b/compiler/ml/ast_mapper_from0.ml @@ -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) diff --git a/compiler/ml/ast_mapper_to0.ml b/compiler/ml/ast_mapper_to0.ml index 68be8b7cbf..9cbd9f3303 100644 --- a/compiler/ml/ast_mapper_to0.ml +++ b/compiler/ml/ast_mapper_to0.ml @@ -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) @@ -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) diff --git a/compiler/ml/btype.ml b/compiler/ml/btype.ml index 7afaf52f4b..81e8d24cd0 100644 --- a/compiler/ml/btype.ml +++ b/compiler/ml/btype.ml @@ -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; diff --git a/compiler/ml/ctype.ml b/compiler/ml/ctype.ml index 9605e37279..de2ad58632 100644 --- a/compiler/ml/ctype.ml +++ b/compiler/ml/ctype.ml @@ -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; @@ -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; }) @@ -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; @@ -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); diff --git a/compiler/ml/depend.ml b/compiler/ml/depend.ml index 47d54954f6..be6e3224fc 100644 --- a/compiler/ml/depend.ml +++ b/compiler/ml/depend.ml @@ -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; @@ -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; diff --git a/compiler/ml/parsetree.ml b/compiler/ml/parsetree.ml index a56f4c9439..0c9beb4bb9 100644 --- a/compiler/ml/parsetree.ml +++ b/compiler/ml/parsetree.ml @@ -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] *) @@ -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 diff --git a/compiler/ml/pprintast.ml b/compiler/ml/pprintast.ml index 2517d60e7d..d6e4c7f0c2 100644 --- a/compiler/ml/pprintast.ml +++ b/compiler/ml/pprintast.ml @@ -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) -> @@ -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 @@ -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 "@[external@ %a@ :@ %a@]%a" protect_ident vd.pval_name.txt (value_description ctxt) vd (item_attributes ctxt) vd.pval_attributes diff --git a/compiler/ml/printast.ml b/compiler/ml/printast.ml index 9af6ff95fc..2469a13256 100644 --- a/compiler/ml/printast.ml +++ b/compiler/ml/printast.ml @@ -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; @@ -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; diff --git a/compiler/ml/printtyped.ml b/compiler/ml/printtyped.ml index 24aea0b5f6..31cb9ef213 100644 --- a/compiler/ml/printtyped.ml +++ b/compiler/ml/printtyped.ml @@ -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 @@ -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 @@ -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; diff --git a/compiler/ml/rec_check.ml b/compiler/ml/rec_check.ml index e8b523882e..43f13b4e2c 100644 --- a/compiler/ml/rec_check.ml +++ b/compiler/ml/rec_check.ml @@ -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 diff --git a/compiler/ml/tast_iterator.ml b/compiler/ml/tast_iterator.ml index e9d0d1688f..3220aa87fe 100644 --- a/compiler/ml/tast_iterator.ml +++ b/compiler/ml/tast_iterator.ml @@ -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 _ -> () @@ -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 @@ -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 _ -> () diff --git a/compiler/ml/tast_mapper.ml b/compiler/ml/tast_mapper.ml index 2a351d783e..8064d65990 100644 --- a/compiler/ml/tast_mapper.ml +++ b/compiler/ml/tast_mapper.ml @@ -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 @@ -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 @@ -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} diff --git a/compiler/ml/translmod.ml b/compiler/ml/translmod.ml index 60f02bcfc9..e3e0ead663 100644 --- a/compiler/ml/translmod.ml +++ b/compiler/ml/translmod.ml @@ -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 *) diff --git a/compiler/ml/typecore.ml b/compiler/ml/typecore.ml index 1780de9958..df9b6ddefa 100644 --- a/compiler/ml/typecore.ml +++ b/compiler/ml/typecore.ml @@ -197,14 +197,11 @@ let iter_expression f e = | Pstr_eval (e, _) -> expr e | Pstr_value (_, pel) -> List.iter binding pel | Pstr_primitive _ | Pstr_type _ | Pstr_typext _ | Pstr_exception _ - | Pstr_modtype _ | Pstr_open _ - | Pstr_class_type () - | Pstr_attribute _ | Pstr_extension _ -> + | Pstr_modtype _ | Pstr_open _ | Pstr_attribute _ | Pstr_extension _ -> () | Pstr_include {pincl_mod = me} | Pstr_module {pmb_expr = me} -> module_expr me | Pstr_recmodule l -> List.iter (fun x -> module_expr x.pmb_expr) l - | Pstr_class () -> () in expr e @@ -477,7 +474,6 @@ let rec build_as_type env p = { row_fields = [(l, Rpresent ty)]; row_more = newvar (); - row_bound = (); row_name = None; row_fixed = false; row_closed = false; @@ -556,7 +552,6 @@ let build_or_pat env loc lid = { row_fields = List.rev fields; row_more = newvar (); - row_bound = (); row_closed = false; row_fixed = false; row_name = Some (path, tyl); @@ -1432,7 +1427,6 @@ and type_pat_aux ~constrs ~labels ~no_existentials ~mode ~explode ~env sp let row = { row_fields = [(l, Reither (sarg = None, arg_type, true, ref None))]; - row_bound = (); row_closed = false; row_more = newvar (); row_fixed = false; @@ -1853,8 +1847,7 @@ and is_nonexpansive_mod mexp = (fun item -> match item.str_desc with | Tstr_eval _ | Tstr_primitive _ | Tstr_type _ | Tstr_modtype _ - | Tstr_open _ - | Tstr_class_type () -> + | Tstr_open _ -> true | Tstr_value (_, pat_exp_list) -> List.for_all (fun vb -> is_nonexpansive vb.vb_expr) pat_exp_list @@ -1873,7 +1866,6 @@ and is_nonexpansive_mod mexp = | {ext_kind = Text_decl _} -> false | {ext_kind = Text_rebind _} -> true) te.tyext_constructors - | Tstr_class () -> assert false (* impossible *) | Tstr_attribute _ -> true) str.str_items | Tmod_apply _ -> false @@ -2129,7 +2121,6 @@ let check_absent_variant env = { row_fields = [(s, Reither (arg = None, ty_arg, true, ref None))]; row_more = newvar (); - row_bound = (); row_closed = false; row_fixed = false; row_name = None; @@ -2564,7 +2555,6 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg = Rejected) env sexp { row_fields = [(l, Rpresent arg_type)]; row_more = newvar (); - row_bound = (); row_closed = false; row_fixed = false; row_name = None; @@ -2979,7 +2969,7 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg = Rejected) env sexp exp_attributes = arg.exp_attributes; exp_env = env; exp_extra = - (Texp_coerce ((), cty'), loc, sexp.pexp_attributes) :: arg.exp_extra; + (Texp_coerce cty', loc, sexp.pexp_attributes) :: arg.exp_extra; } | Pexp_send (e, {txt = met}) -> ( let obj = type_exp env e in diff --git a/compiler/ml/typedtree.ml b/compiler/ml/typedtree.ml index 52a08ef16c..3421de7041 100644 --- a/compiler/ml/typedtree.ml +++ b/compiler/ml/typedtree.ml @@ -67,7 +67,7 @@ and expression = { and exp_extra = | Texp_constraint of core_type - | Texp_coerce of unit * core_type + | Texp_coerce of core_type | Texp_open of override_flag * Path.t * Longident.t loc * Env.t | Texp_newtype of string @@ -133,8 +133,6 @@ and record_label_definition = | Kept of Types.type_expr | Overridden of Longident.t loc * expression -(* Value expressions for the class language *) - (* Value expressions for the module language *) and module_expr = { mod_desc: module_expr_desc; @@ -180,8 +178,6 @@ and structure_item_desc = | Tstr_recmodule of module_binding list | Tstr_modtype of module_type_declaration | Tstr_open of open_description - | Tstr_class of unit - | Tstr_class_type of unit | Tstr_include of include_declaration | Tstr_attribute of attribute @@ -257,8 +253,6 @@ and signature_item_desc = | Tsig_modtype of module_type_declaration | Tsig_open of open_description | Tsig_include of include_description - | Tsig_class of unit - | Tsig_class_type of unit | Tsig_attribute of attribute and module_declaration = { diff --git a/compiler/ml/typedtree.mli b/compiler/ml/typedtree.mli index 5d8819668f..b28f807aba 100644 --- a/compiler/ml/typedtree.mli +++ b/compiler/ml/typedtree.mli @@ -110,8 +110,7 @@ and expression = { and exp_extra = | Texp_constraint of core_type (** E : T *) - | Texp_coerce of unit * core_type - (** E :> T [Texp_coerce T] + | Texp_coerce of core_type (** E :> T [Texp_coerce T] *) | Texp_open of override_flag * Path.t * Longident.t loc * Env.t (** let open[!] M in [Texp_open (!, P, M, env)] @@ -286,8 +285,6 @@ and structure_item_desc = | Tstr_recmodule of module_binding list | Tstr_modtype of module_type_declaration | Tstr_open of open_description - | Tstr_class of unit - | Tstr_class_type of unit | Tstr_include of include_declaration | Tstr_attribute of attribute @@ -362,8 +359,6 @@ and signature_item_desc = | Tsig_modtype of module_type_declaration | Tsig_open of open_description | Tsig_include of include_description - | Tsig_class of unit - | Tsig_class_type of unit | Tsig_attribute of attribute and module_declaration = { diff --git a/compiler/ml/typedtreeIter.ml b/compiler/ml/typedtreeIter.ml index 008d9cab56..e0fe1e228e 100644 --- a/compiler/ml/typedtreeIter.ml +++ b/compiler/ml/typedtreeIter.ml @@ -118,8 +118,6 @@ end = struct | Tstr_recmodule list -> List.iter iter_module_binding list | Tstr_modtype mtd -> iter_module_type_declaration mtd | Tstr_open _ -> () - | Tstr_class () -> () - | Tstr_class_type () -> () | Tstr_include incl -> iter_module_expr incl.incl_mod | Tstr_attribute _ -> ()); Iter.leave_structure_item item @@ -219,7 +217,7 @@ end = struct | cstr, _, _attrs -> ( match cstr with | Texp_constraint ct -> iter_core_type ct - | Texp_coerce ((), cty2) -> iter_core_type cty2 + | Texp_coerce cty2 -> iter_core_type cty2 | Texp_open _ -> () | Texp_newtype _ -> ())) exp.exp_extra; @@ -321,8 +319,6 @@ end = struct | Tsig_modtype mtd -> iter_module_type_declaration mtd | Tsig_open _ -> () | Tsig_include incl -> iter_module_type incl.incl_mod - | Tsig_class () -> () - | Tsig_class_type () -> () | Tsig_attribute _ -> ()); Iter.leave_signature_item item diff --git a/compiler/ml/typemod.ml b/compiler/ml/typemod.ml index 8ff9cb44c5..be6ac27e51 100644 --- a/compiler/ml/typemod.ml +++ b/compiler/ml/typemod.ml @@ -573,8 +573,6 @@ and approx_sig env ssg = in let newenv = Env.add_signature sg env in sg @ approx_sig newenv srem - | Psig_class_type () -> assert false - | Psig_class () -> assert false | _ -> approx_sig env srem) and approx_modtype_info env sinfo = @@ -870,8 +868,6 @@ and transl_signature env sg = in let trem, rem, final_env = transl_sig newenv srem in (mksig (Tsig_include incl) env loc :: trem, sg @ rem, final_env) - | Psig_class _ -> assert false - | Psig_class_type _ -> assert false | Psig_attribute x -> Builtin_attributes.warning_attribute x; let trem, rem, final_env = transl_sig env srem in @@ -1567,8 +1563,6 @@ and type_structure ?(toplevel = false) funct_body anchor env sstr scope = | Pstr_open sod -> let _path, newenv, od = type_open ~toplevel env sod in (Tstr_open od, [], newenv) - | Pstr_class () -> assert false - | Pstr_class_type () -> assert false | Pstr_include sincl -> let smodl = sincl.pincl_mod in let modl = diff --git a/compiler/ml/types.ml b/compiler/ml/types.ml index 215f7e72b6..a7f74ec54e 100644 --- a/compiler/ml/types.ml +++ b/compiler/ml/types.ml @@ -39,7 +39,6 @@ and type_desc = and row_desc = { row_fields: (label * row_field) list; row_more: type_expr; - row_bound: unit; row_closed: bool; row_fixed: bool; row_name: (Path.t * type_expr list) option; diff --git a/compiler/ml/types.mli b/compiler/ml/types.mli index ac09932a09..ce44a9e2ac 100644 --- a/compiler/ml/types.mli +++ b/compiler/ml/types.mli @@ -113,7 +113,6 @@ and type_desc = and row_desc = { row_fields: (label * row_field) list; row_more: type_expr; - row_bound: unit; (* kept for compatibility *) row_closed: bool; row_fixed: bool; row_name: (Path.t * type_expr list) option; diff --git a/compiler/ml/typetexp.ml b/compiler/ml/typetexp.ml index bbd02d5498..30ab5cffd0 100644 --- a/compiler/ml/typetexp.ml +++ b/compiler/ml/typetexp.ml @@ -422,7 +422,6 @@ and transl_type_aux env policy styp = { row_fields = [(l, f)]; row_more = newvar (); - row_bound = (); row_closed = true; row_fixed = false; row_name = None; @@ -509,7 +508,6 @@ and transl_type_aux env policy styp = { row_fields = List.rev fields; row_more = newvar (); - row_bound = (); row_closed = closed = Closed; row_fixed = false; row_name = !name; diff --git a/compiler/syntax/src/res_ast_debugger.ml b/compiler/syntax/src/res_ast_debugger.ml index 6ed8dbbea4..caaaaa6bdd 100644 --- a/compiler/syntax/src/res_ast_debugger.ml +++ b/compiler/syntax/src/res_ast_debugger.ml @@ -179,8 +179,6 @@ module SexpAst = struct [Sexp.atom "Pstr_modtype"; module_type_declaration mod_typ_decl] | Pstr_open open_desc -> Sexp.list [Sexp.atom "Pstr_open"; open_description open_desc] - | Pstr_class _ -> Sexp.atom "Pstr_class" - | Pstr_class_type _ -> Sexp.atom "Pstr_class_type" | Pstr_include id -> Sexp.list [Sexp.atom "Pstr_include"; include_declaration id] | Pstr_attribute attr -> @@ -361,8 +359,6 @@ module SexpAst = struct Sexp.list [Sexp.atom "Psig_open"; open_description open_desc] | Psig_include incl_decl -> Sexp.list [Sexp.atom "Psig_include"; include_description incl_decl] - | Psig_class _ -> Sexp.list [Sexp.atom "Psig_class"] - | Psig_class_type _ -> Sexp.list [Sexp.atom "Psig_class_type"] | Psig_attribute attr -> Sexp.list [Sexp.atom "Psig_attribute"; attribute attr] | Psig_extension (ext, attrs) -> diff --git a/compiler/syntax/src/res_comments_table.ml b/compiler/syntax/src/res_comments_table.ml index 4f40f7f151..523d1289c8 100644 --- a/compiler/syntax/src/res_comments_table.ml +++ b/compiler/syntax/src/res_comments_table.ml @@ -436,7 +436,6 @@ and walk_structure_item si t comments = | Pstr_exception extension_constructor -> walk_extension_constructor extension_constructor t comments | Pstr_typext type_extension -> walk_type_extension type_extension t comments - | Pstr_class_type _ | Pstr_class _ -> () and walk_value_description vd t comments = let leading, trailing = @@ -545,7 +544,6 @@ and walk_signature_item (si : Parsetree.signature_item) t comments = walk_include_description include_description t comments | Psig_attribute attribute -> walk_attribute attribute t comments | Psig_extension (extension, _) -> walk_extension extension t comments - | Psig_class _ | Psig_class_type _ -> () and walk_include_description id t comments = let before, inside, after = partition_by_loc comments id.pincl_mod.pmty_loc in diff --git a/compiler/syntax/src/res_printer.ml b/compiler/syntax/src/res_printer.ml index 60e302a1cb..6aa9aa809f 100644 --- a/compiler/syntax/src/res_printer.ml +++ b/compiler/syntax/src/res_printer.ml @@ -614,7 +614,6 @@ and print_structure_item ~state (si : Parsetree.structure_item) cmt_tbl = print_exception_def ~state extension_constructor cmt_tbl | Pstr_typext type_extension -> print_type_extension ~state type_extension cmt_tbl - | Pstr_class _ | Pstr_class_type _ -> Doc.nil and print_type_extension ~state (te : Parsetree.type_extension) cmt_tbl = let prefix = Doc.text "type " in @@ -974,7 +973,6 @@ and print_signature_item ~state (si : Parsetree.signature_item) cmt_tbl = Doc.concat [print_extension ~state ~at_module_lvl:true extension cmt_tbl]; ] - | Psig_class _ | Psig_class_type _ -> Doc.nil and print_rec_module_declarations ~state module_declarations cmt_tbl = print_listi