Skip to content

Commit d1295a0

Browse files
authored
Use inline keyword from GetSetMember trivia for MemberDefnPropertyGetSetNode. (#2910)
1 parent fc65e0c commit d1295a0

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## [6.0.8] - 2023-06-20
4+
5+
### Fixed
6+
* Inline keyword is missing in property [#2908](https://github.com/fsprojects/fantomas/issues/2908)
7+
38
## [6.0.7] - 2023-06-20
49

510
### Fixed

src/Fantomas.Core.Tests/ClassTests.fs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,3 +1330,28 @@ type X() =
13301330
member private this.Y
13311331
with set _ = ()
13321332
"""
1333+
1334+
[<Test>]
1335+
let ``inline keyword on property, 2908`` () =
1336+
formatSourceString
1337+
false
1338+
"""
1339+
module Meh
1340+
1341+
type Foo =
1342+
member inline this.Item
1343+
with get (i:int,j: char) : string = ""
1344+
and set (i:int,j: char) (x:string) = printfn "%i %c" i j
1345+
"""
1346+
config
1347+
|> prepend newline
1348+
|> should
1349+
equal
1350+
"""
1351+
module Meh
1352+
1353+
type Foo =
1354+
member inline this.Item
1355+
with get (i: int, j: char): string = ""
1356+
and set (i: int, j: char) (x: string) = printfn "%i %c" i j
1357+
"""

src/Fantomas.Core/ASTTransformer.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,11 +2768,11 @@ let mkMemberDefn (creationAide: CreationAide) (md: SynMemberDefn) =
27682768
attributes = ats
27692769
xmlDoc = px
27702770
headPat = SynPat.LongIdent(longDotId = memberName; accessibility = visGet)
2771-
trivia = { LeadingKeyword = lk
2772-
InlineKeyword = inlineKw }) as getBinding),
2771+
trivia = { LeadingKeyword = lk }) as getBinding),
27732772
Some(SynBinding(headPat = SynPat.LongIdent(accessibility = visSet)) as setBinding),
27742773
_,
2775-
{ GetKeyword = Some getKeyword
2774+
{ InlineKeyword = inlineKw
2775+
GetKeyword = Some getKeyword
27762776
SetKeyword = Some setKeyword
27772777
WithKeyword = withKeyword
27782778
AndKeyword = andKeyword }) ->

0 commit comments

Comments
 (0)