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 3636- Fix ` typeof ` parens on functions. https://github.com/rescript-lang/rescript/pull/7643
3737- Rewatch: Add --dev flag to clean command. https://github.com/rescript-lang/rescript/pull/7622
3838- 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
3940
4041# 12.0.0-beta.1
4142
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 =
15121512 Doc. indent
15131513 (Doc. concat
15141514 [
1515- Doc. soft_line;
1515+ ( if rows = [] then Doc. nil else Doc. soft_line) ;
15161516 Doc. join
15171517 ~sep: (Doc. concat [Doc. text " ," ; Doc. line])
15181518 (List. map
@@ -1523,8 +1523,8 @@ and print_literal_dict_expr ~state (e : Parsetree.expression) cmt_tbl =
15231523 print_comments doc cmt_tbl e.pexp_loc)
15241524 rows);
15251525 ]);
1526- Doc. trailing_comma;
1527- Doc. soft_line;
1526+ ( if rows = [] then Doc. nil
1527+ else Doc. concat [ Doc. trailing_comma; Doc. soft_line]) ;
15281528 ])
15291529
15301530and print_constructor_declarations ~state ~private_flag
@@ -4225,6 +4225,7 @@ and print_pexp_apply ~state expr cmt_tbl =
42254225 Doc. concat
42264226 [
42274227 Doc. text " dict{" ;
4228+ print_comments_inside cmt_tbl expr.pexp_loc;
42284229 print_literal_dict_expr ~state key_values cmt_tbl;
42294230 Doc. rbrace;
42304231 ]
Original file line number Diff line number Diff line change 11// empty dict
22let x = dict {}
33
4+ // empty dict with inside comment
5+ let x = dict {
6+ // inside comment
7+
8+ }
9+
410// one value
511let x = dict {"foo" : "bar" }
612
Original file line number Diff line number Diff line change 11// empty dict
22let x = dict{}
33
4+ // empty dict with inside comment
5+ let x = dict{
6+ // inside comment
7+ }
8+
49// one value
510let x = dict{"foo": "bar"}
611
You can’t perform that action at this time.
0 commit comments