Skip to content

Commit

Permalink
Print value of SynConst.UserNum as string. (#767)
Browse files Browse the repository at this point in the history
Fixes #682
  • Loading branch information
nojaf authored Apr 19, 2020
1 parent 0f4e3b5 commit 6a7a947
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/Fantomas.Tests/SynConstTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ module Runner =
end
"""

[<Test>]
let ``array literals of BigInteger, 682`` () =
formatSourceString false "let input = [| 1I;0I;-1I |]" config
|> should equal "let input = [| 1I; 0I; -1I |]
"

[<Test>]
let ``string content ends at string token, 646`` () =
formatSourceString false """"Yarn" ==> "Format"
Expand All @@ -144,4 +150,4 @@ Target.runOrDefault "CheckCodeFormat"
"Yarn" ==> "CheckCodeFormat"
Target.runOrDefault "CheckCodeFormat"
"""
"""
2 changes: 1 addition & 1 deletion src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2706,7 +2706,7 @@ and genConstNumber (c:SynConst) (r: range) =
| SynConst.Decimal(v) -> !- (sprintf "%A" v)
| SynConst.IntPtr(v) -> !- (sprintf "%A" v)
| SynConst.UIntPtr(v) -> !- (sprintf "%A" v)
| SynConst.UserNum(v,s) -> !- (sprintf "%A%s" v s)
| SynConst.UserNum(v,s) -> !- (sprintf "%s%s" v s)
| _ -> failwithf "Cannot generating Const number for %A" c
<| ctx

Expand Down

0 comments on commit 6a7a947

Please sign in to comment.