diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bfe1b60d0..34079500d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - 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 - Fix regression in pattern matching for optional fields containing variants. https://github.com/rescript-lang/rescript/pull/7440 - Fix missing checks for duplicate literals in variants with payloads. https://github.com/rescript-lang/rescript/pull/7441 +- Fix printer removing private for empty record. https://github.com/rescript-lang/rescript/pull/7448 #### :house: Internal diff --git a/compiler/syntax/src/res_printer.ml b/compiler/syntax/src/res_printer.ml index a6f039d031..72c53be91c 100644 --- a/compiler/syntax/src/res_printer.ml +++ b/compiler/syntax/src/res_printer.ml @@ -1289,6 +1289,7 @@ and print_type_declaration2 ?inline_record_definitions ~state ~rec_flag Doc.space; Doc.text equal_sign; Doc.space; + print_private_flag td.ptype_private; Doc.lbrace; print_comments_inside cmt_tbl td.ptype_loc; Doc.rbrace; diff --git a/tests/syntax_tests/data/printer/typeDef/expected/private.res.txt b/tests/syntax_tests/data/printer/typeDef/expected/private.res.txt new file mode 100644 index 0000000000..e3fcb998b3 --- /dev/null +++ b/tests/syntax_tests/data/printer/typeDef/expected/private.res.txt @@ -0,0 +1,5 @@ +type t1 = private {} + +type t2 = private {x: int} + +type t3 = private A | B diff --git a/tests/syntax_tests/data/printer/typeDef/private.res b/tests/syntax_tests/data/printer/typeDef/private.res new file mode 100644 index 0000000000..e3fcb998b3 --- /dev/null +++ b/tests/syntax_tests/data/printer/typeDef/private.res @@ -0,0 +1,5 @@ +type t1 = private {} + +type t2 = private {x: int} + +type t3 = private A | B