Skip to content

Commit

Permalink
Add QMARK_QMARK to FsTokenType. Fixes fsprojects#1503.
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Mar 26, 2021
1 parent 360c1f8 commit d9a0066
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Fantomas.Tests/OperatorTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -971,3 +971,20 @@ let isCustomOperationProjectionParameter i (nm: Ident) =
errorR (Error(FSComp.SR.tcCustomOperationInvalid opName, nm.idRange))
false
"""
[<Test>]
let ``operator with QMARK_QMARK token, 1533`` () =
formatSourceString
false
"""
// Minimal code that displays the root of the issue:
let inline (>??) x = x > x
"""
config
|> prepend newline
|> should
equal
"""
// Minimal code that displays the root of the issue:
let inline (>??) x = x > x
"""
1 change: 1 addition & 0 deletions src/Fantomas/TokenParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,7 @@ let internal getFsToken tokenName =
| "LPAREN_STAR_RPAREN" -> LPAREN_STAR_RPAREN
| "IN" -> IN
| "DO" -> DO
| "QMARK_QMARK" -> QMARK_QMARK
| _ -> failwithf "was not expecting token %s" tokenName

let getTriviaNodesFromTokens (mkRange: MkRange) (tokens: Token list) =
Expand Down
1 change: 1 addition & 0 deletions src/Fantomas/TriviaTypes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type FsTokenType =
| LPAREN_STAR_RPAREN
| IN
| DO
| QMARK_QMARK

type Token =
{ TokenInfo: FSharpTokenInfo
Expand Down

0 comments on commit d9a0066

Please sign in to comment.