Skip to content

Commit

Permalink
Determine if DotGet expression is upper- or lowercase. Fixes fsprojec…
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Apr 24, 2020
1 parent 4a67f8a commit 957a922
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/Fantomas.Tests/LetBindingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -467,4 +467,33 @@ let genSigModuleDeclList astContext node =
(col sepNln xs (genSigModuleDecl astContext)
+> sepXsAndYs
+> genSigModuleDeclList astContext ys) ctx
"""
"""

[<Test>]
let ``determine lower or uppercase in DotGet, 729`` () =
formatSourceString false """namespace Foo
open System.Linq
module Bar =
let Baz () =
for foo in bar().OfType<SomeType>() do
printf "baz"
for foo in bar().meh<SomeType>() do
printf "baz"
""" config
|> prepend newline
|> should equal """
namespace Foo
open System.Linq
module Bar =
let Baz () =
for foo in bar().OfType<SomeType>() do
printf "baz"
for foo in bar().meh<SomeType> () do
printf "baz"
"""
2 changes: 2 additions & 0 deletions src/Fantomas/SourceParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,8 @@ let (|UppercaseSynExpr|LowercaseSynExpr|) (synExpr:SynExpr) =
| Some lp -> upperOrLower lp
| None -> LowercaseSynExpr

| SynExpr.DotGet (_,_,LongIdentWithDots(lid),_) -> upperOrLower lid

| _ -> failwithf "cannot determine if synExpr %A is uppercase or lowercase" synExpr

let rec isEmptySynSimplePats (ssp:SynSimplePats) =
Expand Down

0 comments on commit 957a922

Please sign in to comment.