Skip to content

Commit

Permalink
genTrivia for SynExpr.TypeApp. Fixes fsprojects#1543.
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Mar 26, 2021
1 parent cdf6308 commit 1b29955
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/Fantomas.Tests/CompilerDirectivesTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2414,3 +2414,34 @@ let tcrefObjTy, enclosingDeclaredTypars, renaming, objTy =
FreshenTyconRef m rigid tcref declaredTyconTypars
#endif
"""

[<Test>]
let ``defines as trivia for SynExpr.TypeApp, 1543`` () =
formatSourceString
false
"""
let inputFileFlagsFsiBase (_tcConfigB: TcConfigBuilder) =
#if NETSTANDARD
[ CompilerOption("usesdkrefs", tagNone, OptionSwitch (SetUseSdkSwitch _tcConfigB), None, Some (FSComp.SR.useSdkRefs())) ]
#else
List.empty<CompilerOption>
#endif
"""
config
|> prepend newline
|> should
equal
"""
let inputFileFlagsFsiBase (_tcConfigB: TcConfigBuilder) =
#if NETSTANDARD
[ CompilerOption(
"usesdkrefs",
tagNone,
OptionSwitch(SetUseSdkSwitch _tcConfigB),
None,
Some(FSComp.SR.useSdkRefs ())
) ]
#else
List.empty<CompilerOption>
#endif
"""
1 change: 1 addition & 0 deletions src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2706,6 +2706,7 @@ and genExpr astContext synExpr ctx =
| SynExpr.ObjExpr _ -> genTriviaFor SynExpr_ObjExpr synExpr.Range
| SynExpr.JoinIn _ -> genTriviaFor SynExpr_JoinIn synExpr.Range
| SynExpr.Do _ -> genTriviaFor SynExpr_Do synExpr.Range
| SynExpr.TypeApp _ -> genTriviaFor SynExpr_TypeApp synExpr.Range
| _ -> id)

expr ctx
Expand Down

0 comments on commit 1b29955

Please sign in to comment.