File tree Expand file tree Collapse file tree 4 files changed +16
-3
lines changed
tests/syntax_tests/data/printer/expr Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 36
36
- Fix ` typeof ` parens on functions. https://github.com/rescript-lang/rescript/pull/7643
37
37
- Rewatch: Add --dev flag to clean command. https://github.com/rescript-lang/rescript/pull/7622
38
38
- Rewatch: Use root package suffix in clean log messages. https://github.com/rescript-lang/rescript/pull/7648
39
+ - Fix inside comment printing for empty dict. https://github.com/rescript-lang/rescript/pull/7654
39
40
40
41
# 12.0.0-beta.1
41
42
Original file line number Diff line number Diff line change @@ -1512,7 +1512,7 @@ and print_literal_dict_expr ~state (e : Parsetree.expression) cmt_tbl =
1512
1512
Doc. indent
1513
1513
(Doc. concat
1514
1514
[
1515
- Doc. soft_line;
1515
+ ( if rows = [] then Doc. nil else Doc. soft_line) ;
1516
1516
Doc. join
1517
1517
~sep: (Doc. concat [Doc. text " ," ; Doc. line])
1518
1518
(List. map
@@ -1523,8 +1523,8 @@ and print_literal_dict_expr ~state (e : Parsetree.expression) cmt_tbl =
1523
1523
print_comments doc cmt_tbl e.pexp_loc)
1524
1524
rows);
1525
1525
]);
1526
- Doc. trailing_comma;
1527
- Doc. soft_line;
1526
+ ( if rows = [] then Doc. nil
1527
+ else Doc. concat [ Doc. trailing_comma; Doc. soft_line]) ;
1528
1528
])
1529
1529
1530
1530
and print_constructor_declarations ~state ~private_flag
@@ -4225,6 +4225,7 @@ and print_pexp_apply ~state expr cmt_tbl =
4225
4225
Doc. concat
4226
4226
[
4227
4227
Doc. text " dict{" ;
4228
+ print_comments_inside cmt_tbl expr.pexp_loc;
4228
4229
print_literal_dict_expr ~state key_values cmt_tbl;
4229
4230
Doc. rbrace;
4230
4231
]
Original file line number Diff line number Diff line change 1
1
// empty dict
2
2
let x = dict {}
3
3
4
+ // empty dict with inside comment
5
+ let x = dict {
6
+ // inside comment
7
+
8
+ }
9
+
4
10
// one value
5
11
let x = dict {"foo" : "bar" }
6
12
Original file line number Diff line number Diff line change 1
1
// empty dict
2
2
let x = dict{}
3
3
4
+ // empty dict with inside comment
5
+ let x = dict{
6
+ // inside comment
7
+ }
8
+
4
9
// one value
5
10
let x = dict{"foo": "bar"}
6
11
You can’t perform that action at this time.
0 commit comments