Skip to content

Commit

Permalink
- add missing cases Expr.Paren, Expr.App to (|UppercaseExpr|Lowercase…
Browse files Browse the repository at this point in the history
…Expr|) to fix 2998

- add test
- add CHANGELOG entry
  • Loading branch information
dawedawe committed Jun 1, 2024
1 parent 9925f66 commit 32caa36
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
15 changes: 15 additions & 0 deletions src/Fantomas.Core.Tests/DynamicOperatorTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
"""

[<Test>]
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"
"""
2 changes: 2 additions & 0 deletions src/Fantomas.Core/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down

0 comments on commit 32caa36

Please sign in to comment.