Skip to content

Commit 5bb9a8e

Browse files
committed
Fix printing of optional label.
1 parent d3f0840 commit 5bb9a8e

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

jscomp/ml/printtyp.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ and tree_of_constructor cd =
928928
and tree_of_label l =
929929
let opt = l.ld_attributes |> List.exists (fun ({txt}, _) -> txt = "optional") in
930930
let typ = match l.ld_type.desc with
931-
| Tconstr (p, [t1], _) when Path.same p Predef.path_option -> t1
931+
| Tconstr (p, [t1], _) when opt && Path.same p Predef.path_option -> t1
932932
| _ -> l.ld_type in
933933
(Ident.name l.ld_id, l.ld_mutable = Mutable, opt, tree_of_typexp false typ)
934934

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33359,7 +33359,7 @@ and tree_of_constructor cd =
3335933359
and tree_of_label l =
3336033360
let opt = l.ld_attributes |> List.exists (fun ({txt}, _) -> txt = "optional") in
3336133361
let typ = match l.ld_type.desc with
33362-
| Tconstr (p, [t1], _) when Path.same p Predef.path_option -> t1
33362+
| Tconstr (p, [t1], _) when opt && Path.same p Predef.path_option -> t1
3336333363
| _ -> l.ld_type in
3336433364
(Ident.name l.ld_id, l.ld_mutable = Mutable, opt, tree_of_typexp false typ)
3336533365

lib/4.06.1/unstable/js_playground_compiler.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33359,7 +33359,7 @@ and tree_of_constructor cd =
3335933359
and tree_of_label l =
3336033360
let opt = l.ld_attributes |> List.exists (fun ({txt}, _) -> txt = "optional") in
3336133361
let typ = match l.ld_type.desc with
33362-
| Tconstr (p, [t1], _) when Path.same p Predef.path_option -> t1
33362+
| Tconstr (p, [t1], _) when opt && Path.same p Predef.path_option -> t1
3336333363
| _ -> l.ld_type in
3336433364
(Ident.name l.ld_id, l.ld_mutable = Mutable, opt, tree_of_typexp false typ)
3336533365

lib/4.06.1/whole_compiler.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207890,7 +207890,7 @@ and tree_of_constructor cd =
207890207890
and tree_of_label l =
207891207891
let opt = l.ld_attributes |> List.exists (fun ({txt}, _) -> txt = "optional") in
207892207892
let typ = match l.ld_type.desc with
207893-
| Tconstr (p, [t1], _) when Path.same p Predef.path_option -> t1
207893+
| Tconstr (p, [t1], _) when opt && Path.same p Predef.path_option -> t1
207894207894
| _ -> l.ld_type in
207895207895
(Ident.name l.ld_id, l.ld_mutable = Mutable, opt, tree_of_typexp false typ)
207896207896

0 commit comments

Comments
 (0)