File tree 3 files changed +26
-3
lines changed
3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
- ## [ Unreleased ]
3
+ ## 6.3.8 - 2024-06-06
4
4
5
5
### 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 )
7
7
8
8
## 6.3.7 - 2024-06-01
9
9
Original file line number Diff line number Diff line change @@ -2286,3 +2286,26 @@ match synExpr with
2286
2286
) -> Some ident.idRange
2287
2287
| _ -> defaultTraverse synExpr
2288
2288
"""
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) =
2163
2163
match node.LeftHandSide with
2164
2164
| IsIfThenElse _ when ( ctx.Config.IndentSize - 1 <= node.Operator.Text.Length) ->
2165
2165
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) ->
2167
2167
let ctxAfterMatch = genExpr node.LeftHandSide ctx
2168
2168
2169
2169
let lastClauseIsSingleLine =
You can’t perform that action at this time.
0 commit comments