diff --git a/src/analysis/ppx_expand.ml b/src/analysis/ppx_expand.ml index f50b912d..5d2add8b 100644 --- a/src/analysis/ppx_expand.ml +++ b/src/analysis/ppx_expand.ml @@ -143,10 +143,7 @@ let get_ppxed_source ~ppxed_parsetree ~pos ppx_kind_with_attr : | Sig_item _, attr_loc -> let exp = Pprintast.signature Format.str_formatter - { psg_modalities = []; - psg_items = List.rev !signature; - psg_loc = Location.none - }; + (Ast_helper.Sg.mk (List.rev !signature)); Format.flush_str_formatter () in { code = exp; attr_start = attr_loc.loc_start; attr_end = attr_loc.loc_end } diff --git a/src/analysis/ptyp_of_type.ml b/src/analysis/ptyp_of_type.ml index ac4be025..345b7824 100644 --- a/src/analysis/ptyp_of_type.ml +++ b/src/analysis/ptyp_of_type.ml @@ -277,14 +277,10 @@ and signature_item (str_item : Types.signature_item) = Sig.text [ Docstrings.docstring str Location.none ] |> List.hd and signature (items : Types.signature) = - { psg_modalities = []; - psg_items = - List.map (group_items items) ~f:(function - | Item item -> signature_item item - | Type (rec_flag, type_decls) -> - Ast_helper.Sig.type_ rec_flag type_decls); - psg_loc = Location.none - } + Ast_helper.Sg.mk + (List.map (group_items items) ~f:(function + | Item item -> signature_item item + | Type (rec_flag, type_decls) -> Ast_helper.Sig.type_ rec_flag type_decls)) and group_items (items : Types.signature_item list) = let rec read_type type_acc items = diff --git a/src/kernel/extension.ml b/src/kernel/extension.ml index 10693255..c15c4a0b 100644 --- a/src/kernel/extension.ml +++ b/src/kernel/extension.ml @@ -166,7 +166,7 @@ let combine_sigs sigs : Parsetree.signature = psig_loc = Location.none }) in - { psg_modalities = []; psg_items = items; psg_loc = Location.none } + Ast_helper.Sg.mk items let register exts env = (* Log errors ? *) diff --git a/src/kernel/mtyper.ml b/src/kernel/mtyper.ml index ebdd2c41..5e1ac03e 100644 --- a/src/kernel/mtyper.ml +++ b/src/kernel/mtyper.ml @@ -146,7 +146,8 @@ let[@tail_mod_cons] rec type_signature caught env sg psg_modalities psg_loc = sig_sloc = _ } = Typemod.merlin_transl_signature env sg - { psg_modalities; psg_items = [ parsetree_item ]; psg_loc } + (Ast_helper.Sg.mk ~loc:psg_loc ~modalities:psg_modalities + [ parsetree_item ]) in let part_rev_sg = List.rev_append sig_type sg in let item = @@ -269,10 +270,8 @@ let type_interface config caught (parsetree : Parsetree.signature) = } : Typedtree.signature) = Typemod.merlin_transl_signature Env.empty [] - { psg_modalities = parsetree.psg_modalities; - psg_items = []; - psg_loc = parsetree.psg_loc - } + (Ast_helper.Sg.mk ~modalities:parsetree.psg_modalities + ~loc:parsetree.psg_loc []) in let value = Interface_items