Skip to content

Commit

Permalink
Use inline keyword from GetSetMember trivia for MemberDefnPropertyGet…
Browse files Browse the repository at this point in the history
…SetNode. (#2910)
  • Loading branch information
nojaf authored Jun 20, 2023
1 parent fc65e0c commit d1295a0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [6.0.8] - 2023-06-20

### Fixed
* Inline keyword is missing in property [#2908](https://github.com/fsprojects/fantomas/issues/2908)

## [6.0.7] - 2023-06-20

### Fixed
Expand Down
25 changes: 25 additions & 0 deletions src/Fantomas.Core.Tests/ClassTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1330,3 +1330,28 @@ type X() =
member private this.Y
with set _ = ()
"""

[<Test>]
let ``inline keyword on property, 2908`` () =
formatSourceString
false
"""
module Meh
type Foo =
member inline this.Item
with get (i:int,j: char) : string = ""
and set (i:int,j: char) (x:string) = printfn "%i %c" i j
"""
config
|> prepend newline
|> should
equal
"""
module Meh
type Foo =
member inline this.Item
with get (i: int, j: char): string = ""
and set (i: int, j: char) (x: string) = printfn "%i %c" i j
"""
6 changes: 3 additions & 3 deletions src/Fantomas.Core/ASTTransformer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2768,11 +2768,11 @@ let mkMemberDefn (creationAide: CreationAide) (md: SynMemberDefn) =
attributes = ats
xmlDoc = px
headPat = SynPat.LongIdent(longDotId = memberName; accessibility = visGet)
trivia = { LeadingKeyword = lk
InlineKeyword = inlineKw }) as getBinding),
trivia = { LeadingKeyword = lk }) as getBinding),
Some(SynBinding(headPat = SynPat.LongIdent(accessibility = visSet)) as setBinding),
_,
{ GetKeyword = Some getKeyword
{ InlineKeyword = inlineKw
GetKeyword = Some getKeyword
SetKeyword = Some setKeyword
WithKeyword = withKeyword
AndKeyword = andKeyword }) ->
Expand Down

0 comments on commit d1295a0

Please sign in to comment.