From 32caa36de40d18a72ba7bc1307a4f1f008490899 Mon Sep 17 00:00:00 2001 From: dawe Date: Sat, 1 Jun 2024 18:54:05 +0200 Subject: [PATCH] - add missing cases Expr.Paren, Expr.App to (|UppercaseExpr|LowercaseExpr|) to fix 2998 - add test - add CHANGELOG entry --- CHANGELOG.md | 5 +++++ src/Fantomas.Core.Tests/DynamicOperatorTests.fs | 15 +++++++++++++++ src/Fantomas.Core/CodePrinter.fs | 2 ++ 3 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8300a001..4895deda6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 6.3.7 - 2024-06-01 + +### Fixed +* Fix case determination issue with ExprAppNode and ExprParenNode. [#2998](https://github.com/fsprojects/fantomas/issues/2998) + ## 6.3.6 - 2024-06-01 ### Fixed diff --git a/src/Fantomas.Core.Tests/DynamicOperatorTests.fs b/src/Fantomas.Core.Tests/DynamicOperatorTests.fs index 31c3e00b2..2e02219f2 100644 --- a/src/Fantomas.Core.Tests/DynamicOperatorTests.fs +++ b/src/Fantomas.Core.Tests/DynamicOperatorTests.fs @@ -110,3 +110,18 @@ let doc2 = X?a("arg")?B("barg")?c("carg") let doc1 = x?a("arg")?B("barg")?c("carg") let doc2 = X?a ("arg")?B ("barg")?c ("carg") """ + +[] +let ``case determination issue with ExprParenNode uppercase with config lower, 2998`` () = + formatSourceString + """ +let statusBarHeight = (window?getComputedStyle document.documentElement)?getPropertyValue "--statusBarHeight" +""" + config + |> prepend newline + |> should + equal + """ +let statusBarHeight = + (window?getComputedStyle document.documentElement)?getPropertyValue "--statusBarHeight" +""" diff --git a/src/Fantomas.Core/CodePrinter.fs b/src/Fantomas.Core/CodePrinter.fs index 577fb821e..4694bec31 100644 --- a/src/Fantomas.Core/CodePrinter.fs +++ b/src/Fantomas.Core/CodePrinter.fs @@ -58,6 +58,8 @@ let rec (|UppercaseExpr|LowercaseExpr|) (expr: Expr) = | Expr.TypeApp node -> (|UppercaseExpr|LowercaseExpr|) node.Identifier | Expr.Dynamic node -> (|UppercaseExpr|LowercaseExpr|) node.FuncExpr | Expr.AppSingleParenArg node -> (|UppercaseExpr|LowercaseExpr|) node.FunctionExpr + | Expr.Paren node -> (|UppercaseExpr|LowercaseExpr|) node.Expr + | Expr.App node -> (|UppercaseExpr|LowercaseExpr|) node.FunctionExpr | _ -> failwithf "cannot determine if Expr %A is uppercase or lowercase" expr let (|ParenExpr|_|) (e: Expr) =