File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed
Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3- ## [ Unreleased ]
3+ ## 6.3.8 - 2024-06-06
44
55### Fixed
6- * Fix loss of tuple type annotation without parens . [ #2942 ] ( https://github.com/fsprojects/fantomas/issues/2942 )
6+ * Fix precedence change of ` ||> ` due to inserted newline . [ #2866 ] ( https://github.com/fsprojects/fantomas/issues/2866 )
77
88## 6.3.7 - 2024-06-01
99
Original file line number Diff line number Diff line change @@ -2286,3 +2286,26 @@ match synExpr with
22862286 ) -> Some ident.idRange
22872287| _ -> defaultTraverse synExpr
22882288"""
2289+
2290+ [<Test>]
2291+ let ``insertion of a newline changes precedence of the ||> operator , 2866`` () =
2292+ formatSourceString
2293+ """
2294+ let value =
2295+ match "string" with
2296+ | "value" -> "1", "2"
2297+ | _ -> "111111111111111111111111111111111111111111111111111111111111111111111", "22222222222222222222222222222222222"
2298+ ||> createTuple
2299+ """
2300+ config
2301+ |> prepend newline
2302+ |> should
2303+ equal
2304+ """
2305+ let value =
2306+ (match "string" with
2307+ | "value" -> "1", "2"
2308+ | _ ->
2309+ "111111111111111111111111111111111111111111111111111111111111111111111", "22222222222222222222222222222222222")
2310+ ||> createTuple
2311+ """
Original file line number Diff line number Diff line change @@ -2163,7 +2163,7 @@ let genMultilineInfixExpr (node: ExprInfixAppNode) =
21632163 match node.LeftHandSide with
21642164 | IsIfThenElse _ when ( ctx.Config.IndentSize - 1 <= node.Operator.Text.Length) ->
21652165 autoParenthesisIfExpressionExceedsPageWidth ( genExpr node.LeftHandSide) ctx
2166- | Expr.Match _ when ( ctx.Config.IndentSize <= node.Operator.Text.Length) ->
2166+ | Expr.Match _ when ( ctx.Config.IndentSize - 1 <= node.Operator.Text.Length) ->
21672167 let ctxAfterMatch = genExpr node.LeftHandSide ctx
21682168
21692169 let lastClauseIsSingleLine =
You can’t perform that action at this time.
0 commit comments