@@ -151102,7 +151102,7 @@ type out_type =
151102
151102
| Otyp_constr of out_ident * out_type list
151103
151103
| Otyp_manifest of out_type * out_type
151104
151104
| Otyp_object of (string * out_type) list * bool option
151105
- | Otyp_record of (string * bool * out_type) list
151105
+ | Otyp_record of (string * bool * bool * out_type) list
151106
151106
| Otyp_stuff of string
151107
151107
| Otyp_sum of (string * out_type list * out_type option) list
151108
151108
| Otyp_tuple of out_type list
@@ -206110,11 +206110,9 @@ let cautious f ppf arg =
206110
206110
try f ppf arg with
206111
206111
Ellipsis -> fprintf ppf "..."
206112
206112
206113
-
206114
206113
let out_ident = ref pp_print_string
206115
206114
let map_primitive_name = ref (fun x -> x)
206116
206115
206117
-
206118
206116
let print_lident ppf = function
206119
206117
| "::" -> !out_ident ppf "(::)"
206120
206118
| s -> !out_ident ppf s
@@ -206382,7 +206380,7 @@ and print_simple_out_type ppf =
206382
206380
| Otyp_constr (Oide_dot (Oide_dot (Oide_ident "Js_OO", "Callback" ), _),
206383
206381
[tyl])
206384
206382
->
206385
- fprintf ppf "@[<0>(%a@ [@bs.this])@]" print_out_type_1 tyl
206383
+ fprintf ppf "@[<0>(%a@ [@bs.this])@]" print_out_type_1 tyl
206386
206384
| Otyp_constr (id, tyl) ->
206387
206385
pp_open_box ppf 0;
206388
206386
print_typargs ppf tyl;
@@ -206479,8 +206477,8 @@ and print_typargs ppf =
206479
206477
pp_print_char ppf ')';
206480
206478
pp_close_box ppf ();
206481
206479
pp_print_space ppf ()
206482
- and print_out_label ppf (name, mut, arg) =
206483
- fprintf ppf "@[<2>%s%s :@ %a@];" (if mut then "mutable " else "") name
206480
+ and print_out_label ppf (name, mut, opt, arg) =
206481
+ fprintf ppf "@[<2>%s%s%s :@ %a@];" (if opt then "@optional " else "") (if mut then "mutable " else "") name
206484
206482
print_out_type arg
206485
206483
206486
206484
let out_type = ref print_out_type
@@ -207894,7 +207892,11 @@ and tree_of_constructor cd =
207894
207892
(name, args, Some ret)
207895
207893
207896
207894
and tree_of_label l =
207897
- (Ident.name l.ld_id, l.ld_mutable = Mutable, tree_of_typexp false l.ld_type)
207895
+ let opt = l.ld_attributes |> List.exists (fun ({txt}, _) -> txt = "optional") in
207896
+ let typ = match l.ld_type.desc with
207897
+ | Tconstr (p, [t1], _) when Path.same p Predef.path_option -> t1
207898
+ | _ -> l.ld_type in
207899
+ (Ident.name l.ld_id, l.ld_mutable = Mutable, opt, tree_of_typexp false typ)
207898
207900
207899
207901
let tree_of_type_declaration id decl rs =
207900
207902
Osig_type (tree_of_type_decl id decl, tree_of_rec rs)
@@ -294279,10 +294281,11 @@ and printOutConstructorDoc (name, args, gadt) =
294279
294281
in
294280
294282
Doc.group (Doc.concat [Doc.text name; argsDoc; gadtDoc])
294281
294283
294282
- and printRecordDeclRowDoc (name, mut, arg) =
294284
+ and printRecordDeclRowDoc (name, mut, opt, arg) =
294283
294285
Doc.group
294284
294286
(Doc.concat
294285
294287
[
294288
+ (if opt then Doc.text "@optional " else Doc.nil);
294286
294289
(if mut then Doc.text "mutable " else Doc.nil);
294287
294290
printIdentLike ~allowUident:false name;
294288
294291
Doc.text ": ";
0 commit comments