From c8bad188c0aef94347b545342dc16a18d40c9d6b Mon Sep 17 00:00:00 2001 From: Dave Thomas Date: Fri, 20 Jul 2018 17:43:15 +0100 Subject: [PATCH 1/2] Add failing test for access modifies in signatures Test for #284 --- src/Fantomas.Tests/SignatureTests.fs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Fantomas.Tests/SignatureTests.fs b/src/Fantomas.Tests/SignatureTests.fs index 2ad7a4068c..e7139de50a 100644 --- a/src/Fantomas.Tests/SignatureTests.fs +++ b/src/Fantomas.Tests/SignatureTests.fs @@ -136,3 +136,18 @@ module Tainted val GetHashCodeTainted : Tainted<'T> -> int when 'T : equality """ + +[] +let ``should keep access modifiers in signatures seperated``() = + formatSourceString true """ +module Test +type Test = + static member internal FormatAroundCursorAsync : fileName:string -> unit +""" config + |> prepend newline + |> should equal """ +module Test + +type Test = + static member internal FormatAroundCursorAsync : fileName:string -> unit +""" From b8f7934c1568c37062ddcef23c7921ad16036044 Mon Sep 17 00:00:00 2001 From: Dave Thomas Date: Fri, 20 Jul 2018 17:43:57 +0100 Subject: [PATCH 2/2] Fix for #284 if there are access modifiers ensure sepSpace --- src/Fantomas/CodePrinter.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Fantomas/CodePrinter.fs b/src/Fantomas/CodePrinter.fs index 3808658595..c08c5b5d66 100644 --- a/src/Fantomas/CodePrinter.fs +++ b/src/Fantomas/CodePrinter.fs @@ -838,7 +838,7 @@ and genMemberSig astContext = function | MSMember(Val(ats, px, ao, s, t, vi, _), mf) -> let (FunType namedArgs) = (t, vi) genPreXmlDoc px +> genAttributes astContext ats - +> atCurrentColumn (indent +> genMemberFlags { astContext with IsInterface = false } mf +> opt sepNone ao genAccess + +> atCurrentColumn (indent +> genMemberFlags { astContext with IsInterface = false } mf +> opt sepSpace ao genAccess +> ifElse (s = "``new``") (!- "new") (!- s) +> sepColon +> genTypeList astContext namedArgs +> unindent)