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

Pipe reformat eats annotation #629

Merged
merged 5 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
- Initial support for JSX V4, still work in progress.
- :boom: when V4 is activated, at most one component is allowed for each module.

#### :bug: Bug Fix

- Fix issue where the printer would omit attributes for `->` and `|>` https://github.com/rescript-lang/syntax/pull/629

## ReScript 10.0

- Fix printing for inline nullary functor types [#477](https://github.com/rescript-lang/syntax/pull/477)
Expand Down
1 change: 1 addition & 0 deletions src/res_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3658,6 +3658,7 @@ and printBinaryExpression ~customLayout (expr : Parsetree.expression) cmtTbl =
Doc.group
(Doc.concat
[
printAttributes ~customLayout expr.pexp_attributes cmtTbl;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lhsDoc;
(match (lhsHasCommentBelow, op) with
| true, "|." -> Doc.concat [Doc.softLine; Doc.text "->"]
Expand Down
3 changes: 3 additions & 0 deletions tests/printer/expr/expected/pipe.res.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let s1 = @ann x->foo
let s2 = @ann foo(x)
let s3 = @ann x |> foo
3 changes: 3 additions & 0 deletions tests/printer/expr/pipe.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let s1 = @ann (x->foo)
let s2 = @ann (foo(x))
let s3 = @ann (x|>foo)