Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use inline keyword from GetSetMember trivia for MemberDefnPropertyGetSetNode #2910

Merged
merged 1 commit into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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