File tree Expand file tree Collapse file tree 5 files changed +23
-0
lines changed Expand file tree Collapse file tree 5 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 22
22
23
23
+ Handle merlin typed holes (#1698 , @gpetiot )
24
24
25
+ + Handle punned labelled arguments with type constraint in function applications.
26
+ For example, function application of the form ` foo ~(x:int) ` instead of the explicit ` foo ~x:(x:int) ` . (ocaml #10434 ) (#1756 , @gpetiot )
27
+
25
28
### 0.19.0 (2021-07-16)
26
29
27
30
#### Bug fixes
Original file line number Diff line number Diff line change @@ -1350,6 +1350,16 @@ and fmt_label_arg ?(box = true) ?epi ?parens ?eol c
1350
1350
| (Labelled l | Optional l), Pexp_ident {txt= Lident i; loc}
1351
1351
when String. equal l i && List. is_empty arg.pexp_attributes ->
1352
1352
Cmts. fmt c loc @@ Cmts. fmt c ?eol arg.pexp_loc @@ fmt_label lbl " "
1353
+ | ( (Labelled l | Optional l)
1354
+ , Pexp_constraint ({pexp_desc= Pexp_ident {txt= Lident i; _}; _}, _) )
1355
+ when String. equal l i && List. is_empty arg.pexp_attributes ->
1356
+ let lbl =
1357
+ match lbl with
1358
+ | Labelled _ -> str " ~"
1359
+ | Optional _ -> str " ?"
1360
+ | Nolabel -> noop
1361
+ in
1362
+ lbl $ fmt_expression c ~box ?epi ?parens xarg
1353
1363
| _ -> fmt_label lbl " :@," $ fmt_expression c ~box ?epi ?parens xarg
1354
1364
1355
1365
and expression_width c xe =
Original file line number Diff line number Diff line change @@ -83,3 +83,7 @@ let _ =
83
83
(loooooooooooong looooooooooooooong loooooooooooooong
84
84
[loooooooooong; loooooooooooong; loooooooooooooooooooooong]
85
85
)
86
+
87
+ let _ =
88
+ let f ~y = y + 1 in
89
+ f ~(y : int )
Original file line number Diff line number Diff line change @@ -2474,6 +2474,9 @@ labeled_simple_expr:
2474
2474
| TILDE label = LIDENT
2475
2475
{ let loc = $ loc(label) in
2476
2476
(Labelled label, mkexpvar ~loc label) }
2477
+ | TILDE LPAREN label = LIDENT ty = type_constraint RPAREN
2478
+ { (Labelled label, mkexp_constraint ~loc: ($ startpos($ 2 ), $ endpos)
2479
+ (mkexpvar ~loc: $ loc(label) label) ty) }
2477
2480
| QUESTION label = LIDENT
2478
2481
{ let loc = $ loc(label) in
2479
2482
(Optional label, mkexpvar ~loc label) }
Original file line number Diff line number Diff line change @@ -2464,6 +2464,9 @@ labeled_simple_expr:
2464
2464
| TILDE label = LIDENT
2465
2465
{ let loc = $ loc(label) in
2466
2466
(Labelled label, mkexpvar ~loc label) }
2467
+ | TILDE LPAREN label = LIDENT ty = type_constraint RPAREN
2468
+ { (Labelled label, mkexp_constraint ~loc: ($ startpos($ 2 ), $ endpos)
2469
+ (mkexpvar ~loc: $ loc(label) label) ty) }
2467
2470
| QUESTION label = LIDENT
2468
2471
{ let loc = $ loc(label) in
2469
2472
(Optional label, mkexpvar ~loc label) }
You can’t perform that action at this time.
0 commit comments