Skip to content

Commit

Permalink
Printing trivia after SynConst. Fixes fsprojects#598.
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Feb 5, 2020
1 parent b3db683 commit d136309
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
29 changes: 28 additions & 1 deletion src/Fantomas.Tests/SynConstTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,31 @@ let nullstr = "\u0000"
|> should equal """
let nulchar = '\u0000'
let nullstr = "\u0000"
"""
"""

[<Test>]
let ``line comment after custom measure type, 598`` () =
formatSourceString false """namespace Krach
module Runner =
let mPerSecond = 1000<m/second> // foo
[<Measure>]
type ProcessId =
class
end
""" config
|> prepend newline
|> should equal """
namespace Krach
module Runner =
let mPerSecond = 1000<m/second> // foo
[<Measure>]
type ProcessId =
class
end
"""
2 changes: 1 addition & 1 deletion src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2308,7 +2308,7 @@ and genConst (c:SynConst) (r:range) =
| Measure m -> !- m

genConstNumber c r +> measure

|> genTrivia r
and genConstNumber (c:SynConst) (r: range) =
fun (ctx: Context) ->
ctx.Trivia
Expand Down

0 comments on commit d136309

Please sign in to comment.