Skip to content

Commit 6e7f3d3

Browse files
authored
Fix printer removing private for empty record (#7448)
* Syntax test: reproduce bug * Fix printer removing private for empty record * CHANGELOG
1 parent 8f9e0f1 commit 6e7f3d3

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
- Fix JSON escaping in code editor analysis: JSON was not always escaped properly, which prevented code actions from being available in certain situations https://github.com/rescript-lang/rescript/pull/7435
3434
- Fix regression in pattern matching for optional fields containing variants. https://github.com/rescript-lang/rescript/pull/7440
3535
- Fix missing checks for duplicate literals in variants with payloads. https://github.com/rescript-lang/rescript/pull/7441
36+
- Fix printer removing private for empty record. https://github.com/rescript-lang/rescript/pull/7448
3637

3738
#### :house: Internal
3839

compiler/syntax/src/res_printer.ml

+1
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,7 @@ and print_type_declaration2 ?inline_record_definitions ~state ~rec_flag
12891289
Doc.space;
12901290
Doc.text equal_sign;
12911291
Doc.space;
1292+
print_private_flag td.ptype_private;
12921293
Doc.lbrace;
12931294
print_comments_inside cmt_tbl td.ptype_loc;
12941295
Doc.rbrace;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
type t1 = private {}
2+
3+
type t2 = private {x: int}
4+
5+
type t3 = private A | B
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
type t1 = private {}
2+
3+
type t2 = private {x: int}
4+
5+
type t3 = private A | B

0 commit comments

Comments
 (0)