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

fix: prevent stripping of quotes for empty polymorphic variant #474

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
8 changes: 7 additions & 1 deletion src/res_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,13 @@ let printPolyVarIdent txt =
Doc.text txt;
Doc.text"\""
]
| NormalIdent -> Doc.text txt
| NormalIdent -> match txt with
| "" -> Doc.concat [
Doc.text "\"";
Doc.text txt;
Doc.text"\""
]
| _ -> Doc.text txt


let printLident l = match l with
Expand Down
2 changes: 2 additions & 0 deletions tests/printer/pattern/expected/variant.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ switch numericPolyVar {
| #42 => ()
| #3(x, y, z) => Js.log3(x, y, z)
}

let e = #""
2 changes: 2 additions & 0 deletions tests/printer/pattern/variant.res
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ switch numericPolyVar {
| #42 => ()
| #3(x, y, z) => Js.log3(x, y, z)
}

let e = #""