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

Commit 94ae874

Browse files
committed
Check if there are printable attributes in pipe.
1 parent 0d5c02b commit 94ae874

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/res_printer.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3651,7 +3651,9 @@ and printBinaryExpression ~customLayout (expr : Parsetree.expression) cmtTbl =
36513651
[(Nolabel, lhs); (Nolabel, rhs)] )
36523652
when not
36533653
(ParsetreeViewer.isBinaryExpression lhs
3654-
|| ParsetreeViewer.isBinaryExpression rhs) ->
3654+
|| ParsetreeViewer.isBinaryExpression rhs
3655+
|| printAttributes ~customLayout expr.pexp_attributes cmtTbl
3656+
<> Doc.nil) ->
36553657
let lhsHasCommentBelow = hasCommentBelow cmtTbl lhs.pexp_loc in
36563658
let lhsDoc = printOperand ~isLhs:true lhs op in
36573659
let rhsDoc = printOperand ~isLhs:false rhs op in

tests/printer/expr/expected/pipe.res.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
let s1 = @ann x->foo
1+
let s1 = @ann (x->foo)
22
let s1b = (@ann x)->foo
33

4-
let s2 = @ann x |> foo
4+
let s2 = @ann (x |> foo)
55
let s2b = (@ann x) |> foo
66

77
let s3 = @ann (x ** foo)

0 commit comments

Comments
 (0)