Skip to content

Commit cea6328

Browse files
committed
Add attributes field to arg type in typedtree
Introduces an 'attrs' field to the 'arg' record in typedtree.ml and typedtree.mli to support attributes on function arguments. Updates related code in typetexp.ml and printtyped.ml to handle the new field, enabling attribute preservation and printing for function argument types.
1 parent aa61788 commit cea6328

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

compiler/ml/printtyped.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ let rec core_type i ppf x =
152152
| Ttyp_arrow (arg, ret, _) ->
153153
line i ppf "Ttyp_arrow\n";
154154
arg_label i ppf arg.lbl;
155+
attributes i ppf arg.attrs;
155156
core_type i ppf arg.typ;
156157
core_type i ppf ret
157158
| Ttyp_tuple l ->

compiler/ml/typedtree.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ and core_type = {
303303
ctyp_attributes: attribute list;
304304
}
305305

306-
and arg = {lbl: Noloc.arg_label; typ: core_type}
306+
and arg = {attrs: attributes; lbl: Noloc.arg_label; typ: core_type}
307307

308308
and core_type_desc =
309309
| Ttyp_any

compiler/ml/typedtree.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ and core_type = {
409409
ctyp_attributes: attributes;
410410
}
411411

412-
and arg = {lbl: Noloc.arg_label; typ: core_type}
412+
and arg = {attrs: attributes; lbl: Noloc.arg_label; typ: core_type}
413413

414414
and core_type_desc =
415415
| Ttyp_any

compiler/ml/typetexp.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ and transl_type_aux env policy styp =
329329
else ty1
330330
in
331331
let ty = newty (Tarrow ({lbl; typ = ty1}, cty2.ctyp_type, Cok, arity)) in
332-
ctyp (Ttyp_arrow ({lbl; typ = cty1}, cty2, arity)) ty
332+
ctyp (Ttyp_arrow ({attrs = arg.attrs; lbl; typ = cty1}, cty2, arity)) ty
333333
| Ptyp_tuple stl ->
334334
assert (List.length stl >= 2);
335335
let ctys = List.map (transl_type env policy) stl in

0 commit comments

Comments
 (0)