diff options
| author | Alain Frisch <alain@frisch.fr> | 2013-03-06 12:00:18 +0000 |
|---|---|---|
| committer | Alain Frisch <alain@frisch.fr> | 2013-03-06 12:00:18 +0000 |
| commit | 24a0c6eb0e88809613dc27826a61fb2683824985 (patch) | |
| tree | 40319a900deb98a24018671789a7f19cee81a987 | |
| parent | 241abe55e667ce68c6b335c2b124852f2b043b5c (diff) | |
| download | ocaml-24a0c6eb0e88809613dc27826a61fb2683824985.tar.gz | |
Name is part of the value_description record.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13357 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
| -rw-r--r-- | camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml | 8 | ||||
| -rw-r--r-- | camlp4/boot/Camlp4.ml | 15 | ||||
| -rw-r--r-- | ocamldoc/odoc_ast.ml | 3 | ||||
| -rw-r--r-- | ocamldoc/odoc_sig.ml | 5 | ||||
| -rw-r--r-- | otherlibs/labltk/browser/searchid.ml | 4 | ||||
| -rw-r--r-- | otherlibs/labltk/browser/searchpos.ml | 2 | ||||
| -rw-r--r-- | parsing/ast_mapper.ml | 11 | ||||
| -rw-r--r-- | parsing/ast_mapper.mli | 4 | ||||
| -rw-r--r-- | parsing/parser.mly | 21 | ||||
| -rw-r--r-- | parsing/parsetree.mli | 7 | ||||
| -rw-r--r-- | parsing/pprintast.ml | 20 | ||||
| -rw-r--r-- | parsing/printast.ml | 10 | ||||
| -rw-r--r-- | tools/depend.ml | 4 | ||||
| -rw-r--r-- | tools/untypeast.ml | 7 | ||||
| -rw-r--r-- | typing/typemod.ml | 12 |
15 files changed, 71 insertions, 62 deletions
diff --git a/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml b/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml index 641b909968..0bb580ba3e 100644 --- a/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml +++ b/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml @@ -376,7 +376,7 @@ module Make (Ast : Sig.Camlp4Ast) = struct value type_decl name tl cl t loc = type_decl name tl cl loc None False t; - value mkvalue_desc loc t p = {pval_type = ctyp t; pval_prim = p; pval_loc = mkloc loc; pval_attributes = []}; + value mkvalue_desc loc name t p = {pval_name = name; pval_type = ctyp t; pval_prim = p; pval_loc = mkloc loc; pval_attributes = []}; value rec list_of_meta_list = fun @@ -1000,7 +1000,7 @@ value varify_constructors var_names = | <:sig_item@loc< exception $uid:s$ of $t$ >> -> [mksig loc (Psig_exception {ped_name=with_loc (conv_con s) loc; ped_args=List.map ctyp (list_of_ctyp t []); ped_attributes=[]}) :: l] | SgExc _ _ -> assert False (*FIXME*) - | SgExt loc n t sl -> [mksig loc (Psig_value (with_loc n loc) (mkvalue_desc loc t (list_of_meta_list sl))) :: l] + | SgExt loc n t sl -> [mksig loc (Psig_value (mkvalue_desc loc (with_loc n loc) t (list_of_meta_list sl))) :: l] | SgInc loc mt -> [mksig loc (Psig_include (module_type mt) []) :: l] | SgMod loc n mt -> [mksig loc (Psig_module {pmd_name=with_loc n loc; pmd_type=module_type mt; pmd_attributes=[]}) :: l] | SgRecMod loc mb -> @@ -1015,7 +1015,7 @@ value varify_constructors var_names = | SgOpn loc id -> [mksig loc (Psig_open (long_uident id) []) :: l] | SgTyp loc tdl -> [mksig loc (Psig_type (mktype_decl tdl [])) :: l] - | SgVal loc n t -> [mksig loc (Psig_value (with_loc n loc) (mkvalue_desc loc t [])) :: l] + | SgVal loc n t -> [mksig loc (Psig_value (mkvalue_desc loc (with_loc n loc) t [])) :: l] | <:sig_item@loc< $anti:_$ >> -> error loc "antiquotation in sig_item" ] and module_sig_binding x acc = match x with @@ -1076,7 +1076,7 @@ value varify_constructors var_names = error loc "type in exception alias" | StExc _ _ _ -> assert False (*FIXME*) | StExp loc e -> [mkstr loc (Pstr_eval (expr e)) :: l] - | StExt loc n t sl -> [mkstr loc (Pstr_primitive (with_loc n loc) (mkvalue_desc loc t (list_of_meta_list sl))) :: l] + | StExt loc n t sl -> [mkstr loc (Pstr_primitive (mkvalue_desc loc (with_loc n loc) t (list_of_meta_list sl))) :: l] | StInc loc me -> [mkstr loc (Pstr_include (module_expr me, [])) :: l] | StMod loc n me -> [mkstr loc (Pstr_module {pmb_name=with_loc n loc;pmb_expr=module_expr me;pmb_attributes=[]}) :: l] | StRecMod loc mb -> diff --git a/camlp4/boot/Camlp4.ml b/camlp4/boot/Camlp4.ml index 41db302f02..9a216b3179 100644 --- a/camlp4/boot/Camlp4.ml +++ b/camlp4/boot/Camlp4.ml @@ -14542,8 +14542,9 @@ module Struct = let type_decl name tl cl t loc = type_decl name tl cl loc None false t - let mkvalue_desc loc t p = - { pval_type = ctyp t; pval_prim = p; pval_loc = mkloc loc; + let mkvalue_desc loc name t p = + { pval_name = name; + pval_type = ctyp t; pval_prim = p; pval_loc = mkloc loc; pval_attributes = []; } @@ -15329,8 +15330,8 @@ module Struct = | SgExc (_, _) -> assert false | SgExt (loc, n, t, sl) -> (mksig loc - (Psig_value ((with_loc n loc), - (mkvalue_desc loc t (list_of_meta_list sl))))) :: + (Psig_value + (mkvalue_desc loc (with_loc n loc) t (list_of_meta_list sl)))) :: l | SgInc (loc, mt) -> (mksig loc (Psig_include (module_type mt, []))) :: l @@ -15353,7 +15354,7 @@ module Struct = (mksig loc (Psig_type (mktype_decl tdl []))) :: l | SgVal (loc, n, t) -> (mksig loc - (Psig_value ((with_loc n loc), (mkvalue_desc loc t [])))) :: + (Psig_value (mkvalue_desc loc (with_loc n loc) t []))) :: l | Ast.SgAnt (loc, _) -> error loc "antiquotation in sig_item" and module_sig_binding x acc = @@ -15443,8 +15444,8 @@ module Struct = | StExp (loc, e) -> (mkstr loc (Pstr_eval (expr e))) :: l | StExt (loc, n, t, sl) -> (mkstr loc - (Pstr_primitive ((with_loc n loc), - (mkvalue_desc loc t (list_of_meta_list sl))))) :: + (Pstr_primitive + (mkvalue_desc loc (with_loc n loc) t (list_of_meta_list sl)))) :: l | StInc (loc, me) -> (mkstr loc (Pstr_include (module_expr me, []))) :: l diff --git a/ocamldoc/odoc_ast.ml b/ocamldoc/odoc_ast.ml index d64b7d5836..9241a1187f 100644 --- a/ocamldoc/odoc_ast.ml +++ b/ocamldoc/odoc_ast.ml @@ -1118,7 +1118,8 @@ module Analyser = let (new_env, l_ele) = iter ~first: true loc.Location.loc_start.Lexing.pos_cnum env [] pat_exp_list in (0, new_env, l_ele) - | Parsetree.Pstr_primitive ({ txt = name_pre }, val_desc) -> + | Parsetree.Pstr_primitive val_desc -> + let name_pre = val_desc.Parsetree.pval_name.txt in (* of string * value_description *) print_DEBUG ("Parsetree.Pstr_primitive ("^name_pre^", ["^(String.concat ", " val_desc.Parsetree.pval_prim)^"]"); let typ = Typedtree_search.search_primitive table name_pre in diff --git a/ocamldoc/odoc_sig.ml b/ocamldoc/odoc_sig.ml index e1c7a1f65d..4a2031da31 100644 --- a/ocamldoc/odoc_sig.ml +++ b/ocamldoc/odoc_sig.ml @@ -269,7 +269,7 @@ module Analyser = let take_item psig_desc = { sig_item with Parsetree.psig_desc } :: acc in match sig_item.Parsetree.psig_desc with | Parsetree.Psig_extension _ - | Parsetree.Psig_value (_, _) + | Parsetree.Psig_value _ | Parsetree.Psig_exception _ | Parsetree.Psig_open _ | Parsetree.Psig_include _ @@ -522,7 +522,8 @@ module Analyser = and analyse_signature_item_desc env signat table current_module_name sig_item_loc pos_start_ele pos_end_ele pos_limit comment_opt sig_item_desc = match sig_item_desc with - Parsetree.Psig_value (name_pre, value_desc) -> + Parsetree.Psig_value value_desc -> + let name_pre = value_desc.Parsetree.pval_name in let type_expr = try Signature_search.search_value table name_pre.txt with Not_found -> diff --git a/otherlibs/labltk/browser/searchid.ml b/otherlibs/labltk/browser/searchid.ml index b19e5769dc..128d95d34e 100644 --- a/otherlibs/labltk/browser/searchid.ml +++ b/otherlibs/labltk/browser/searchid.ml @@ -460,7 +460,7 @@ let search_structure str ~name ~kind ~prefix = then loc := pat.ppat_loc.loc_start.Lexing.pos_cnum end; false - | Pstr_primitive (s, _) when kind = Pvalue -> name = s.txt + | Pstr_primitive vd when kind = Pvalue -> name = vd.pval_name.txt | Pstr_type l when kind = Ptype -> List.iter l ~f: begin fun td -> @@ -513,7 +513,7 @@ let search_signature sign ~name ~kind ~prefix = List.iter (search_module_type sign ~prefix) ~f: begin fun item -> if match item.psig_desc with - Psig_value (s, _) when kind = Pvalue -> name = s.txt + Psig_value vd when kind = Pvalue -> name = vd.pval_name.txt | Psig_type l when kind = Ptype -> List.iter l ~f: begin fun td -> diff --git a/otherlibs/labltk/browser/searchpos.ml b/otherlibs/labltk/browser/searchpos.ml index 4e5335fb7f..c4145502d2 100644 --- a/otherlibs/labltk/browser/searchpos.ml +++ b/otherlibs/labltk/browser/searchpos.ml @@ -202,7 +202,7 @@ let rec search_pos_signature l ~pos ~env = in if in_loc ~pos pt.psig_loc then begin match pt.psig_desc with - Psig_value (_, desc) -> search_pos_type desc.pval_type ~pos ~env + Psig_value desc -> search_pos_type desc.pval_type ~pos ~env | Psig_type l -> List.iter l ~f:(search_pos_type_decl ~pos ~env) | Psig_exception ped -> diff --git a/parsing/ast_mapper.ml b/parsing/ast_mapper.ml index 6ed25a5755..ca92d053d4 100644 --- a/parsing/ast_mapper.ml +++ b/parsing/ast_mapper.ml @@ -204,7 +204,7 @@ module MT = struct let mk_item ?(loc = Location.none) x = {psig_desc = x; psig_loc = loc} - let value ?loc a b = mk_item ?loc (Psig_value (a, b)) + let value ?loc a = mk_item ?loc (Psig_value a) let type_ ?loc a = mk_item ?loc (Psig_type a) let exception_ ?loc a = mk_item ?loc (Psig_exception a) let module_ ?loc a = mk_item ?loc (Psig_module a) @@ -219,7 +219,7 @@ module MT = struct let map_signature_item sub {psig_desc = desc; psig_loc = loc} = let loc = sub # location loc in match desc with - | Psig_value (s, vd) -> value ~loc (map_loc sub s) (sub # value_description vd) + | Psig_value vd -> value ~loc (sub # value_description vd) | Psig_type l -> type_ ~loc (List.map (sub # type_declaration) l) | Psig_exception ed -> exception_ ~loc (sub # exception_declaration ed) | Psig_module x -> module_ ~loc (sub # module_declaration x) @@ -262,7 +262,7 @@ module M = struct let mk_item ?(loc = Location.none) x = {pstr_desc = x; pstr_loc = loc} let eval ?loc a = mk_item ?loc (Pstr_eval a) let value ?loc a b = mk_item ?loc (Pstr_value (a, b)) - let primitive ?loc a b = mk_item ?loc (Pstr_primitive (a, b)) + let primitive ?loc a = mk_item ?loc (Pstr_primitive a) let type_ ?loc a = mk_item ?loc (Pstr_type a) let exception_ ?loc a = mk_item ?loc (Pstr_exception a) let exn_rebind ?loc ?(attributes = []) a b = mk_item ?loc (Pstr_exn_rebind (a, b, attributes)) @@ -280,7 +280,7 @@ module M = struct match desc with | Pstr_eval x -> eval ~loc (sub # expr x) | Pstr_value (r, pel) -> value ~loc r (List.map (map_tuple (sub # pat) (sub # expr)) pel) - | Pstr_primitive (name, vd) -> primitive ~loc (map_loc sub name) (sub # value_description vd) + | Pstr_primitive vd -> primitive ~loc (sub # value_description vd) | Pstr_type l -> type_ ~loc (List.map (sub # type_declaration) l) | Pstr_exception ed -> exception_ ~loc (sub # exception_declaration ed) | Pstr_exn_rebind (s, lid, attrs) -> exn_rebind ~loc (map_loc sub s) (map_loc sub lid) ~attributes:(map_attributes sub attrs) @@ -527,8 +527,9 @@ class mapper = method type_kind = T.map_type_kind this method typ = T.map this - method value_description {pval_type; pval_prim; pval_loc; pval_attributes} = + method value_description {pval_name; pval_type; pval_prim; pval_loc; pval_attributes} = { + pval_name = map_loc this pval_name; pval_type = this # typ pval_type; pval_prim; pval_loc = this # location pval_loc; diff --git a/parsing/ast_mapper.mli b/parsing/ast_mapper.mli index dbaaf06e26..4cea9b96b2 100644 --- a/parsing/ast_mapper.mli +++ b/parsing/ast_mapper.mli @@ -146,7 +146,7 @@ module MT: val map: mapper -> module_type -> module_type val map_with_constraint: mapper -> with_constraint -> with_constraint val mk_item: ?loc:Location.t -> signature_item_desc -> signature_item - val value: ?loc:Location.t -> string loc -> value_description -> signature_item + val value: ?loc:Location.t -> value_description -> signature_item val type_: ?loc:Location.t -> type_declaration list -> signature_item val exception_: ?loc:Location.t -> exception_declaration -> signature_item val module_: ?loc:Location.t -> module_declaration -> signature_item @@ -172,7 +172,7 @@ module M: val mk_item: ?loc:Location.t -> structure_item_desc -> structure_item val eval: ?loc:Location.t -> expression -> structure_item val value: ?loc:Location.t -> rec_flag -> (pattern * expression) list -> structure_item - val primitive: ?loc:Location.t -> string loc -> value_description -> structure_item + val primitive: ?loc:Location.t -> value_description -> structure_item val type_: ?loc:Location.t -> type_declaration list -> structure_item val exception_: ?loc:Location.t -> exception_declaration -> structure_item val exn_rebind: ?loc:Location.t -> ?attributes:attribute list -> string loc -> Longident.t loc -> structure_item diff --git a/parsing/parser.mly b/parsing/parser.mly index f3f3977948..bf242e9978 100644 --- a/parsing/parser.mly +++ b/parsing/parser.mly @@ -611,9 +611,10 @@ structure_item: [{ ppat_desc = Ppat_any; ppat_loc = _ }, exp] -> mkstr(Pstr_eval exp) | l -> mkstr(Pstr_value($2, List.rev l)) } | pre_item_attributes EXTERNAL val_ident COLON core_type EQUAL primitive_declaration post_item_attributes - { mkstr(Pstr_primitive(mkrhs $3 3, {pval_type = $5; pval_prim = $7; - pval_attributes = $1 @ $8; - pval_loc = symbol_rloc ()})) } + { mkstr(Pstr_primitive {pval_name = mkrhs $3 3; + pval_type = $5; pval_prim = $7; + pval_attributes = $1 @ $8; + pval_loc = symbol_rloc ()}) } | pre_item_attributes TYPE type_declarations { let l = patch_first_rev $3 (fun td -> {td with ptype_attributes = $1 @ td.ptype_attributes}) in @@ -696,13 +697,15 @@ signature: ; signature_item: pre_item_attributes VAL val_ident COLON core_type post_item_attributes - { mksig(Psig_value(mkrhs $3 3, {pval_type = $5; pval_prim = []; - pval_attributes = $1 @ $6; - pval_loc = symbol_rloc()})) } + { mksig(Psig_value {pval_name = mkrhs $3 3; + pval_type = $5; pval_prim = []; + pval_attributes = $1 @ $6; + pval_loc = symbol_rloc()}) } | pre_item_attributes EXTERNAL val_ident COLON core_type EQUAL primitive_declaration post_item_attributes - { mksig(Psig_value(mkrhs $3 3, {pval_type = $5; pval_prim = $7; - pval_attributes = $1 @ $8; - pval_loc = symbol_rloc()})) } + { mksig(Psig_value {pval_name = mkrhs $3 3; + pval_type = $5; pval_prim = $7; + pval_attributes = $1 @ $8; + pval_loc = symbol_rloc()}) } | pre_item_attributes TYPE type_declarations { let l = patch_first_rev $3 (fun td -> {td with ptype_attributes = $1 @ td.ptype_attributes}) in diff --git a/parsing/parsetree.mli b/parsing/parsetree.mli index a19531ff26..ffeecc8848 100644 --- a/parsing/parsetree.mli +++ b/parsing/parsetree.mli @@ -137,7 +137,8 @@ and expression_desc = (* Value descriptions *) and value_description = - { pval_type: core_type; + { pval_name: string loc; + pval_type: core_type; pval_prim: string list; pval_attributes: attribute list; pval_loc: Location.t @@ -268,7 +269,7 @@ and signature_item = psig_loc: Location.t } and signature_item_desc = - Psig_value of string loc * value_description + Psig_value of value_description | Psig_type of type_declaration list | Psig_exception of exception_declaration | Psig_module of module_declaration @@ -322,7 +323,7 @@ and structure_item = and structure_item_desc = Pstr_eval of expression | Pstr_value of rec_flag * (pattern * expression) list - | Pstr_primitive of string loc * value_description + | Pstr_primitive of value_description | Pstr_type of type_declaration list | Pstr_exception of exception_declaration | Pstr_exn_rebind of string loc * Longident.t loc * attribute list diff --git a/parsing/pprintast.ml b/parsing/pprintast.ml index 5679ef6691..8567bc8854 100644 --- a/parsing/pprintast.ml +++ b/parsing/pprintast.ml @@ -863,15 +863,15 @@ class printer ()= object(self:'self) match x.psig_desc with | Psig_type l -> self#type_def_list f l - | Psig_value (s, vd) -> + | Psig_value vd -> pp f "@[<2>%a@]" - (fun f (s,vd) -> + (fun f vd -> let intro = if vd.pval_prim = [] then "val" else "external" in - if (is_infix (fixity_of_string s.txt)) || List.mem s.txt.[0] prefix_symbols then - pp f "%s@ (@ %s@ )@ :@ " intro s.txt + if (is_infix (fixity_of_string vd.pval_name.txt)) || List.mem vd.pval_name.txt.[0] prefix_symbols then + pp f "%s@ (@ %s@ )@ :@ " intro vd.pval_name.txt else - pp f "%s@ %s@ :@ " intro s.txt; - self#value_description f vd;) (s,vd) + pp f "%s@ %s@ :@ " intro vd.pval_name.txt; + self#value_description f vd;) vd | Psig_exception ed -> self#exception_declaration f ed | Psig_class l -> @@ -1069,14 +1069,14 @@ class printer ()= object(self:'self) ~last:"@]@]" class_declaration f xs) | Pstr_class_type (l) -> self#class_type_declaration_list f l ; - | Pstr_primitive (s, vd) -> + | Pstr_primitive vd -> let need_parens = - match s.txt with + match vd.pval_name.txt with | "or" | "mod" | "land"| "lor" | "lxor" | "lsl" | "lsr" | "asr" -> true - | _ -> match s.txt.[0] with + | _ -> match vd.pval_name.txt.[0] with 'a'..'z' -> false | _ -> true in pp f "@[<hov2>external@ %s@ :@ %a@]" - (if need_parens then "( "^s.txt^" )" else s.txt) + (if need_parens then "( "^vd.pval_name.txt^" )" else vd.pval_name.txt) self#value_description vd | Pstr_include (me, _attrs) -> pp f "@[<hov2>include@ %a@]" self#module_expr me diff --git a/parsing/printast.ml b/parsing/printast.ml index fbd54f09c1..d8ade79e31 100644 --- a/parsing/printast.ml +++ b/parsing/printast.ml @@ -360,7 +360,7 @@ and expression i ppf x = expression i ppf arg and value_description i ppf x = - line i ppf "value_description %a\n" fmt_location x.pval_loc; + line i ppf "value_description %a %a\n" fmt_string_loc x.pval_name fmt_location x.pval_loc; core_type (i+1) ppf x.pval_type; list (i+1) string ppf x.pval_prim; attributes (i+1) ppf x.pval_attributes @@ -582,8 +582,8 @@ and signature_item i ppf x = line i ppf "signature_item %a\n" fmt_location x.psig_loc; let i = i+1 in match x.psig_desc with - | Psig_value (s, vd) -> - line i ppf "Psig_value %a\n" fmt_string_loc s; + | Psig_value vd -> + line i ppf "Psig_value\n"; value_description i ppf vd; | Psig_type (l) -> line i ppf "Psig_type\n"; @@ -681,8 +681,8 @@ and structure_item i ppf x = | Pstr_value (rf, l) -> line i ppf "Pstr_value %a\n" fmt_rec_flag rf; list i pattern_x_expression_def ppf l; - | Pstr_primitive (s, vd) -> - line i ppf "Pstr_primitive %a\n" fmt_string_loc s; + | Pstr_primitive vd -> + line i ppf "Pstr_primitive\n"; value_description i ppf vd; | Pstr_type l -> line i ppf "Pstr_type\n"; diff --git a/tools/depend.ml b/tools/depend.ml index 0abf62efd2..41f0239fa4 100644 --- a/tools/depend.ml +++ b/tools/depend.ml @@ -217,7 +217,7 @@ and add_signature bv = function and add_sig_item bv item = match item.psig_desc with - Psig_value(id, vd) -> + Psig_value vd -> add_type bv vd.pval_type; bv | Psig_type dcls -> List.iter (add_type_declaration bv) dcls; bv @@ -273,7 +273,7 @@ and add_struct_item bv item = add_expr bv e; bv | Pstr_value(rf, pel) -> let bv = add_bindings rf bv pel in bv - | Pstr_primitive(id, vd) -> + | Pstr_primitive vd -> add_type bv vd.pval_type; bv | Pstr_type dcls -> List.iter (add_type_declaration bv) dcls; bv diff --git a/tools/untypeast.ml b/tools/untypeast.ml index 74918fbb3b..030b4e301d 100644 --- a/tools/untypeast.ml +++ b/tools/untypeast.ml @@ -48,7 +48,7 @@ and untype_structure_item item = Pstr_value (rec_flag, List.map (fun (pat, exp) -> untype_pattern pat, untype_expression exp) list) | Tstr_primitive (_id, name, v) -> - Pstr_primitive (name, untype_value_description v) + Pstr_primitive (untype_value_description name v) | Tstr_type list -> Pstr_type (List.map (fun (_id, name, decl) -> untype_type_declaration name decl) list) @@ -101,8 +101,9 @@ and untype_structure_item item = in { pstr_desc = desc; pstr_loc = item.str_loc; } -and untype_value_description v = +and untype_value_description name v = { + pval_name = name; pval_prim = v.val_prim; pval_type = untype_core_type v.val_desc; pval_loc = v.val_loc; @@ -320,7 +321,7 @@ and untype_signature_item item = let desc = match item.sig_desc with Tsig_value (_id, name, v) -> - Psig_value (name, untype_value_description v) + Psig_value (untype_value_description name v) | Tsig_type list -> Psig_type (List.map (fun (_id, name, decl) -> untype_type_declaration name decl diff --git a/typing/typemod.ml b/typing/typemod.ml index c1db4c1bdb..cc514375ac 100644 --- a/typing/typemod.ml +++ b/typing/typemod.ml @@ -460,14 +460,14 @@ and transl_signature env sg = | item :: srem -> let loc = item.psig_loc in match item.psig_desc with - | Psig_value(name, sdesc) -> + | Psig_value sdesc -> let tdesc = Typedecl.transl_value_decl env item.psig_loc sdesc in let desc = tdesc.val_val in let (id, newenv) = - Env.enter_value name.txt desc env + Env.enter_value sdesc.pval_name.txt desc env ~check:(fun s -> Warnings.Unused_value_declaration s) in let (trem,rem, final_env) = transl_sig newenv srem in - mksig (Tsig_value (id, name, tdesc)) env loc :: trem, + mksig (Tsig_value (id, sdesc.pval_name, tdesc)) env loc :: trem, (if List.exists (Ident.equal id) (get_values rem) then rem else Sig_value(id, desc) :: rem), final_env @@ -975,11 +975,11 @@ and type_structure ?(toplevel = false) funct_body anchor env sstr scope = (item :: str_rem, map_end make_sig_value bound_idents sig_rem, final_env) - | Pstr_primitive(name, sdesc) -> + | Pstr_primitive sdesc -> let desc = Typedecl.transl_value_decl env loc sdesc in - let (id, newenv) = Env.enter_value name.txt desc.val_val env + let (id, newenv) = Env.enter_value sdesc.pval_name.txt desc.val_val env ~check:(fun s -> Warnings.Unused_value_declaration s) in - let item = mk (Tstr_primitive(id, name, desc)) in + let item = mk (Tstr_primitive(id, sdesc.pval_name, desc)) in let (str_rem, sig_rem, final_env) = type_struct newenv srem in (item :: str_rem, Sig_value(id, desc.val_val) :: sig_rem, final_env) | Pstr_type sdecls -> |
