Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Fix printing of optional fiels in records #631

Merged
merged 2 commits into from
Sep 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#### :bug: Bug Fix

- Fix issue where the printer would omit attributes for `->` and `|>` https://github.com/rescript-lang/syntax/pull/629
- Fix printing of optional fiels in records https://github.com/rescript-lang/rescript-compiler/issues/5654

## ReScript 10.0

Expand Down
2 changes: 1 addition & 1 deletion src/res_outcome_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,9 @@ and printRecordDeclRowDoc (name, mut, opt, arg) =
Doc.group
(Doc.concat
[
(if opt then Doc.text "?" else Doc.nil);
(if mut then Doc.text "mutable " else Doc.nil);
printIdentLike ~allowUident:false name;
(if opt then Doc.text "?" else Doc.nil);
Doc.text ": ";
printOutTypeDoc arg;
])
Expand Down
2 changes: 1 addition & 1 deletion tests/oprint/expected/oprint.resi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -486,4 +486,4 @@ type emptyObject = {.}
let f: (~x: 'a=?, ~y: 'b) => option<'a>
type call = CleanStart
let f: (~a: int=?, unit) => int
type opt = {x: int, ?y: string}
type opt = {x: int, y?: string}