diff --git a/src/Fantomas.Tests/ClassTests.fs b/src/Fantomas.Tests/ClassTests.fs index 150e63f4c1..dba72264d7 100644 --- a/src/Fantomas.Tests/ClassTests.fs +++ b/src/Fantomas.Tests/ClassTests.fs @@ -32,14 +32,14 @@ module Heap type Heap<'T when 'T: comparison> = class - new : capacity: int -> Heap<'T> - member Clear : unit -> unit - member ExtractMin : unit -> 'T - member Insert : k: 'T -> unit - member IsEmpty : unit -> bool - member PeekMin : unit -> 'T - override ToString : unit -> string - member Count : int + new: capacity: int -> Heap<'T> + member Clear: unit -> unit + member ExtractMin: unit -> 'T + member Insert: k: 'T -> unit + member IsEmpty: unit -> bool + member PeekMin: unit -> 'T + override ToString: unit -> string + member Count: int end """ @@ -65,19 +65,19 @@ type Class7<'T when 'T : (new : unit -> 'T)>() = |> should equal """ -type Class4<'T when 'T: (static member staticMethod1 : unit -> 'T)> = +type Class4<'T when 'T: (static member staticMethod1: unit -> 'T)> = class end -type Class5<'T when 'T: (member Method1 : 'T -> int)> = +type Class5<'T when 'T: (member Method1: 'T -> int)> = class end -type Class6<'T when 'T: (member Property1 : int)> = +type Class6<'T when 'T: (member Property1: int)> = class end -type Class7<'T when 'T: (new : unit -> 'T)>() = +type Class7<'T when 'T: (new: unit -> 'T)>() = member val Field = new 'T() """ @@ -124,15 +124,15 @@ type Shape2D(x0: float, y0: float) = with get () = y and set yval = y <- yval - abstract Area : float - abstract Perimeter : float - abstract Name : string + abstract Area: float + abstract Perimeter: float + abstract Name: string member this.Move dx dy = x <- x + dx y <- y + dy - abstract member Rotate : float -> unit + abstract member Rotate: float -> unit default this.Rotate(angle) = rotAngle <- rotAngle + angle """ @@ -156,13 +156,13 @@ type A = equal """ type A = - abstract B : ?p1: (float * int) -> unit - abstract C : ?p1: float * int -> unit - abstract D : ?p1: (int -> int) -> unit - abstract E : ?p1: float -> unit - abstract F : ?p1: float * ?p2: float -> unit - abstract G : p1: float * ?p2: float -> unit - abstract H : float * ?p2: float -> unit + abstract B: ?p1: (float * int) -> unit + abstract C: ?p1: float * int -> unit + abstract D: ?p1: (int -> int) -> unit + abstract E: ?p1: float -> unit + abstract F: ?p1: float * ?p2: float -> unit + abstract G: p1: float * ?p2: float -> unit + abstract H: float * ?p2: float -> unit """ [] @@ -615,9 +615,9 @@ let ``no extra new line before abstract member with attribute, 586`` () = type A = [] - abstract Create : Unit -> A + abstract Create: Unit -> A - abstract b : Unit -> Unit + abstract b: Unit -> Unit """ [] @@ -627,10 +627,10 @@ let ``no extra new line between abstract members with attribute, 586`` () = type A = [] - abstract a : Unit -> string + abstract a: Unit -> string [] - abstract b : Unit -> string + abstract b: Unit -> string """ [] @@ -780,7 +780,7 @@ type Foo = module Example type Foo = - abstract member bar : int + abstract member bar: int """ [] @@ -830,9 +830,9 @@ type ISingleExpressionValue<'p, 'o, 'v when 'p :> IProperty and 'o :> IOperator """ type ISingleExpressionValue<'p, 'o, 'v when 'p :> IProperty and 'o :> IOperator and 'p: equality and 'o: equality and 'v: equality> () = - abstract Property : 'p - abstract Operator : 'o - abstract Value : 'v + abstract Property: 'p + abstract Operator: 'o + abstract Value: 'v """ [] diff --git a/src/Fantomas.Tests/CommentTests.fs b/src/Fantomas.Tests/CommentTests.fs index 6adcdf6954..d8d204080c 100644 --- a/src/Fantomas.Tests/CommentTests.fs +++ b/src/Fantomas.Tests/CommentTests.fs @@ -1070,12 +1070,12 @@ type IExports = """ [] type IExports = - abstract DataSet : DataSetStatic - abstract DataView : DataViewStatic - abstract Graph2d : Graph2dStatic - abstract Timeline : TimelineStatic + abstract DataSet: DataSetStatic + abstract DataView: DataViewStatic + abstract Graph2d: Graph2dStatic + abstract Timeline: TimelineStatic // abstract Timeline: TimelineStaticStatic - abstract Network : NetworkStatic + abstract Network: NetworkStatic // type [] MomentConstructor1 = // [] abstract Invoke: ?inp: MomentInput * ?format: MomentFormatSpecification * ?strict: bool -> Moment diff --git a/src/Fantomas.Tests/FormatAstTests.fs b/src/Fantomas.Tests/FormatAstTests.fs index 0dfcb5dd51..3a1536c0da 100644 --- a/src/Fantomas.Tests/FormatAstTests.fs +++ b/src/Fantomas.Tests/FormatAstTests.fs @@ -91,7 +91,7 @@ type Foo = equal """[] type Foo = - abstract foo : int + abstract foo: int override __.foo = 1""" [] @@ -107,7 +107,7 @@ type Foo = equal """[] type Foo = - abstract foo : int + abstract foo: int default __.foo = 1""" [] @@ -123,7 +123,7 @@ type Foo = equal """[] type Foo = - abstract foo : int + abstract foo: int override __.foo = 1""" [] diff --git a/src/Fantomas.Tests/FunctionDefinitionTests.fs b/src/Fantomas.Tests/FunctionDefinitionTests.fs index a2e590df65..095659c28e 100644 --- a/src/Fantomas.Tests/FunctionDefinitionTests.fs +++ b/src/Fantomas.Tests/FunctionDefinitionTests.fs @@ -219,9 +219,9 @@ let inline heterogenousAdd(value1 : ^T when (^T or ^U) : (static member (+) : ^T |> should equal """ -let inline add (value1: ^T when ^T: (static member (+) : ^T * ^T -> ^T), value2: ^T) = value1 + value2 +let inline add (value1: ^T when ^T: (static member (+): ^T * ^T -> ^T), value2: ^T) = value1 + value2 -let inline heterogenousAdd (value1: ^T when (^T or ^U): (static member (+) : ^T * ^U -> ^T), value2: ^U) = +let inline heterogenousAdd (value1: ^T when (^T or ^U): (static member (+): ^T * ^U -> ^T), value2: ^U) = value1 + value2 """ @@ -448,8 +448,8 @@ let inline implicit< ^a,^b when ^a : (static member op_Implicit : ^b -> ^a)> arg |> should equal """ -let inline implicit< ^a, ^b when ^a: (static member op_Implicit : ^b -> ^a)> arg = - (^a: (static member op_Implicit : ^b -> ^a) arg) +let inline implicit< ^a, ^b when ^a: (static member op_Implicit: ^b -> ^a)> arg = + (^a: (static member op_Implicit: ^b -> ^a) arg) """ [] @@ -491,7 +491,7 @@ let ``don't create redundant parentheses outside trait calls`` () = |> should equal """ -let f (arg: 'T) = (^T: (member Value : string) arg) +let f (arg: 'T) = (^T: (member Value: string) arg) """ [] @@ -934,7 +934,7 @@ let inline deserialize< ^a when ( ^a or FromJsonDefaults) : (static member FromJ |> should equal """ -let inline deserialize< ^a when ^a: (static member FromJson : ^a -> Json< ^a >)> json = +let inline deserialize< ^a when ^a: (static member FromJson: ^a -> Json< ^a >)> json = json |> Json.parse |> Json.deserialize< ^a> """ diff --git a/src/Fantomas.Tests/InterfaceTests.fs b/src/Fantomas.Tests/InterfaceTests.fs index 72c17cfb43..47cc936dea 100644 --- a/src/Fantomas.Tests/InterfaceTests.fs +++ b/src/Fantomas.Tests/InterfaceTests.fs @@ -26,7 +26,7 @@ type Interface3 = equal """ type IPrintable = - abstract member Print : unit -> unit + abstract member Print: unit -> unit type SomeClass1(x: int, y: float) = interface IPrintable with @@ -35,7 +35,7 @@ type SomeClass1(x: int, y: float) = type Interface3 = inherit Interface1 inherit Interface2 - abstract member Method3 : int -> int + abstract member Method3: int -> int """ [] @@ -135,7 +135,7 @@ let ``should keep named arguments on abstract members`` () = |> should equal """type IThing = - abstract Foo : name: string * age: int -> bool + abstract Foo: name: string * age: int -> bool """ [] @@ -149,7 +149,7 @@ let ``should not skip 'with get()' in indexers`` () = |> should equal """type Interface = - abstract Item : int -> char with get + abstract Item: int -> char with get """ [] @@ -202,10 +202,10 @@ type MyLogInteface() = equal """ type LogInterface = - abstract member Print : string -> unit - abstract member GetLogFile : string -> string - abstract member Info : unit -> unit - abstract member Version : unit -> unit + abstract member Print: string -> unit + abstract member GetLogFile: string -> string + abstract member Info: unit -> unit + abstract member Version: unit -> unit type MyLogInteface() = interface LogInterface with @@ -234,7 +234,7 @@ type IArgParserTemplate = """/// Interface that must be implemented by all Argu template types type IArgParserTemplate = /// returns a usage string for every union case - abstract Usage : string + abstract Usage: string """ [] @@ -273,7 +273,7 @@ type Test = equal """ type Test = - abstract RunJobs : + abstract RunJobs: folder: string * ?jobs: string * ?ctm: string @@ -319,8 +319,8 @@ type IMyInterface = equal """ type IMyInterface = - abstract MyProp : bool with get, set - abstract MyMethod : unit -> unit + abstract MyProp: bool with get, set + abstract MyMethod: unit -> unit """ [] diff --git a/src/Fantomas.Tests/ModuleTests.fs b/src/Fantomas.Tests/ModuleTests.fs index 62242dca49..54d16dcf81 100644 --- a/src/Fantomas.Tests/ModuleTests.fs +++ b/src/Fantomas.Tests/ModuleTests.fs @@ -167,15 +167,15 @@ end""" """ module Utils -val turnTracingOn : unit -> unit -val turnTracingOff : unit -> unit -val isTraced : unit -> bool +val turnTracingOn: unit -> unit +val turnTracingOff: unit -> unit +val isTraced: unit -> bool module Random = - val exponential : mean: float -> float - val nextInt : max: int -> int - val nextInt64 : max: int64 -> int64 - val next : max: float -> float + val exponential: mean: float -> float + val nextInt: max: int -> int + val nextInt64: max: int64 -> int64 + val next: max: float -> float """ [] @@ -703,7 +703,7 @@ namespace Test module App = type Msg = B of C - val a : string + val a: string """ [] diff --git a/src/Fantomas.Tests/NewlineBetweenTypeDefinitionAndMembersTests.fs b/src/Fantomas.Tests/NewlineBetweenTypeDefinitionAndMembersTests.fs index 6b77bd479e..9ebbacdf56 100644 --- a/src/Fantomas.Tests/NewlineBetweenTypeDefinitionAndMembersTests.fs +++ b/src/Fantomas.Tests/NewlineBetweenTypeDefinitionAndMembersTests.fs @@ -185,7 +185,7 @@ type Range = To: float Name: string } - member Length : unit -> int + member Length: unit -> int """ [] @@ -211,7 +211,7 @@ type Color = | Green | Blue - member ToInt : unit -> int + member ToInt: unit -> int """ [] @@ -237,7 +237,7 @@ type Color = | Green = 1 | Blue = 2 - member ToInt : unit -> int + member ToInt: unit -> int """ [] @@ -257,7 +257,7 @@ namespace Signature type HttpContext with - member QueryString : unit -> string + member QueryString: unit -> string """ [] @@ -306,7 +306,7 @@ type MyRecord = Street: string Number: int } - member Score : unit -> int + member Score: unit -> int type MyRecord = { SomeField: int } @@ -318,7 +318,7 @@ type Color = | Green = 1 | Blue = 2 - member ToInt : unit -> int + member ToInt: unit -> int """ [] diff --git a/src/Fantomas.Tests/NumberOfItemsRecordTests.fs b/src/Fantomas.Tests/NumberOfItemsRecordTests.fs index d45a4b1f7e..151b120adc 100644 --- a/src/Fantomas.Tests/NumberOfItemsRecordTests.fs +++ b/src/Fantomas.Tests/NumberOfItemsRecordTests.fs @@ -595,7 +595,7 @@ type MyRecord = Bar: string Street: string Number: int } - member Score : unit -> int + member Score: unit -> int """ diff --git a/src/Fantomas.Tests/RecordTests.fs b/src/Fantomas.Tests/RecordTests.fs index 8e323953ed..3fa57bb720 100644 --- a/src/Fantomas.Tests/RecordTests.fs +++ b/src/Fantomas.Tests/RecordTests.fs @@ -87,25 +87,25 @@ type Element = interface INode /// Constructs an new empty Element. - static member Create : name: string * ?uri: string -> Element + static member Create: name: string * ?uri: string -> Element /// Replaces the children. - static member WithChildren : children: #seq<#INode> -> self: Element -> Element + static member WithChildren: children: #seq<#INode> -> self: Element -> Element /// Replaces the children. - static member (-) : self: Element * children: #seq<#INode> -> Element + static member (-): self: Element * children: #seq<#INode> -> Element /// Replaces the attributes. - static member WithAttributes : attrs: #seq -> self: Element -> Element + static member WithAttributes: attrs: #seq -> self: Element -> Element /// Replaces the attributes. - static member (+) : self: Element * attrs: #seq -> Element + static member (+): self: Element * attrs: #seq -> Element /// Replaces the children with a single text node. - static member WithText : text: string -> self: Element -> Element + static member WithText: text: string -> self: Element -> Element /// Replaces the children with a single text node. - static member (--) : self: Element * text: string -> Element + static member (--): self: Element * text: string -> Element """ [] @@ -840,7 +840,7 @@ open System module Test = type ISomething = inherit IDisposable - abstract DoTheThing : string -> unit + abstract DoTheThing: string -> unit let test (something: IDisposable) (somethingElse: IDisposable) = { new ISomething with @@ -1419,7 +1419,7 @@ module Foo = { ModeratelyLongName: int } type private Bang = - abstract Baz : int + abstract Baz: int """ [] diff --git a/src/Fantomas.Tests/SignatureTests.fs b/src/Fantomas.Tests/SignatureTests.fs index 4d00b4f8e7..40491bb2b3 100644 --- a/src/Fantomas.Tests/SignatureTests.fs +++ b/src/Fantomas.Tests/SignatureTests.fs @@ -122,7 +122,7 @@ type A () = equal """ type IA = - abstract F : (unit -> Option<'T>) -> Option<'T> + abstract F: (unit -> Option<'T>) -> Option<'T> type A() = interface IA with @@ -148,9 +148,9 @@ type C = namespace TupleType type C = - member P1 : int * string + member P1: int * string /// def - member P2 : int + member P2: int """ [] @@ -168,7 +168,7 @@ val GetHashCodeTainted : (Tainted<'T> -> int) when 'T : equality """ module Tainted -val GetHashCodeTainted : (Tainted<'T> -> int) when 'T: equality +val GetHashCodeTainted: (Tainted<'T> -> int) when 'T: equality """ [] @@ -188,7 +188,7 @@ type Test = module Test type Test = - static member internal FormatAroundCursorAsync : fileName: string -> unit + static member internal FormatAroundCursorAsync: fileName: string -> unit """ [] @@ -304,25 +304,25 @@ module Teq = /// Order isn't important /// a = b => b = a /// If you always do this followed by a cast, you may as well just use castFrom - val symmetry : Teq<'a, 'b> -> Teq<'b, 'a> + val symmetry: Teq<'a, 'b> -> Teq<'b, 'a> /// Let's compose two type-equalities: a = b && b = c => a = c - val transitivity : Teq<'a, 'b> -> Teq<'b, 'c> -> Teq<'a, 'c> + val transitivity: Teq<'a, 'b> -> Teq<'b, 'c> -> Teq<'a, 'c> /// Converts an 'a to a 'b - val cast : Teq<'a, 'b> -> ('a -> 'b) + val cast: Teq<'a, 'b> -> ('a -> 'b) /// Converts an 'a to a 'b /// Alias for cast - val castTo : Teq<'a, 'b> -> ('a -> 'b) + val castTo: Teq<'a, 'b> -> ('a -> 'b) /// Converts a 'b to an 'a /// Equivalent to symmetry >> cast, but more efficient - val castFrom : Teq<'a, 'b> -> ('b -> 'a) + val castFrom: Teq<'a, 'b> -> ('b -> 'a) /// Utility function to map an object of one type using a mapping function /// for a different type when we have a type equality between the two types - val mapAs : Teq<'a, 'b> -> ('b -> 'b) -> 'a -> 'a + val mapAs: Teq<'a, 'b> -> ('b -> 'b) -> 'a -> 'a /// The Cong module (short for congruence) contains functions that /// allow you safely transform Teqs into other Teqs that logically follow. @@ -426,25 +426,25 @@ module Teq = /// Order isn't important /// a = b => b = a /// If you always do this followed by a cast, you may as well just use castFrom - val symmetry : Teq<'a, 'b> -> Teq<'b, 'a> + val symmetry: Teq<'a, 'b> -> Teq<'b, 'a> /// Let's compose two type-equalities: a = b && b = c => a = c - val transitivity : Teq<'a, 'b> -> Teq<'b, 'c> -> Teq<'a, 'c> + val transitivity: Teq<'a, 'b> -> Teq<'b, 'c> -> Teq<'a, 'c> /// Converts an 'a to a 'b - val cast : Teq<'a, 'b> -> ('a -> 'b) + val cast: Teq<'a, 'b> -> ('a -> 'b) /// Converts an 'a to a 'b /// Alias for cast - val castTo : Teq<'a, 'b> -> ('a -> 'b) + val castTo: Teq<'a, 'b> -> ('a -> 'b) /// Converts a 'b to an 'a /// Equivalent to symmetry >> cast, but more efficient - val castFrom : Teq<'a, 'b> -> ('b -> 'a) + val castFrom: Teq<'a, 'b> -> ('b -> 'a) /// Utility function to map an object of one type using a mapping function /// for a different type when we have a type equality between the two types - val mapAs : Teq<'a, 'b> -> ('b -> 'b) -> 'a -> 'a + val mapAs: Teq<'a, 'b> -> ('b -> 'b) -> 'a -> 'a /// The Cong module (short for congruence) contains functions that /// allow you safely transform Teqs into other Teqs that logically follow. @@ -544,10 +544,10 @@ type T with namespace ExtensionParts type T = - new : unit -> T + new: unit -> T type T with - member Foo : int + member Foo: int """ [] @@ -584,7 +584,7 @@ open FSharp.Compiler.SourceCodeServices [] type CodeFormatter = /// Parse a source string using given config - static member ParseAsync : + static member ParseAsync: fileName: string * source: SourceOrigin * parsingOptions: FSharpParsingOptions * checker: FSharpChecker -> Async<(ParsedInput * string list) array> """ @@ -660,7 +660,7 @@ type internal Blah = namespace Foo type internal Blah = - abstract Baz : unit + abstract Baz: unit """ [] @@ -721,8 +721,8 @@ module Foo = namespace Blah module Foo = - val inline sum : ('a -> ^value) -> 'a Foo -> ^value - when ^value: (static member (+) : ^value * ^value -> ^value) and ^value: (static member Zero : ^value) + val inline sum: ('a -> ^value) -> 'a Foo -> ^value + when ^value: (static member (+): ^value * ^value -> ^value) and ^value: (static member Zero: ^value) """ [] @@ -878,7 +878,7 @@ module Some_module type foo = bool -val bar : bool +val bar: bool """ [] @@ -981,20 +981,20 @@ module Example module Foo = module Bar = type t = bool - val lol : unit -> bool + val lol: unit -> bool type t = int - val lmao : unit -> bool + val lmao: unit -> bool module Foo2 = module Bar = type t = bool - val lol : unit -> bool + val lol: unit -> bool type t = int - val lmao : unit -> bool + val lmao: unit -> bool """ [] @@ -1023,7 +1023,7 @@ type t1 = bool [] type t2 = bool -val foo : bool +val foo: bool """ [] @@ -1163,7 +1163,7 @@ namespace Baz [] type Foo = - member inline Return : 'a -> Baz<'a> + member inline Return: 'a -> Baz<'a> """ [] @@ -1186,7 +1186,7 @@ namespace Baz [] type Foo = - member inline private Return : 'a -> Baz<'a> + member inline private Return: 'a -> Baz<'a> """ [] @@ -1210,12 +1210,12 @@ type C = """ namespace Foo -val blah : int +val blah: int type C = - member P1 : int * string + member P1: int * string /// def - member P2 : int + member P2: int """ [] @@ -1234,7 +1234,7 @@ val create : something_really_long : unit -> another_really_long_thing : unit -> """ namespace Bug -val create : +val create: something_really_long: unit -> another_really_long_thing: unit -> and_another_to_make_the_line_long_enough: unit -> @@ -1350,7 +1350,7 @@ module Bar = [] /// - val f : unit -> unit + val f: unit -> unit """ [] @@ -1428,7 +1428,7 @@ val inline internal u_tup4 : unpickler<'T2> -> unpickler<'T3> -> unpickler<'T4> module internal FSharp.Compiler.TypedTreePickle /// Deserialize a tuple -val inline internal u_tup4 : +val inline internal u_tup4: unpickler<'T2> -> unpickler<'T3> -> unpickler<'T4> -> unpickler<'T5> -> unpickler<'T2 * 'T3 * 'T4 * 'T5> """ @@ -1514,7 +1514,7 @@ and [] Bang = LongNameBarBarBarBarBarBarBar: int } /// - override GetHashCode : unit -> int + override GetHashCode: unit -> int """ [] @@ -1599,5 +1599,5 @@ type Foo = private { Bar: int Qux: string } - static member Baz : int + static member Baz: int """ diff --git a/src/Fantomas.Tests/SpecialConstructsTests.fs b/src/Fantomas.Tests/SpecialConstructsTests.fs index 73c0479659..49664a1532 100644 --- a/src/Fantomas.Tests/SpecialConstructsTests.fs +++ b/src/Fantomas.Tests/SpecialConstructsTests.fs @@ -37,7 +37,7 @@ x.G[].TryFind 3 equal """ type F = - abstract G : int list -> Map + abstract G: int list -> Map let x: F = {new F with diff --git a/src/Fantomas.Tests/TypeDeclarationTests.fs b/src/Fantomas.Tests/TypeDeclarationTests.fs index 5c3a6c1abb..8c7c8f790f 100644 --- a/src/Fantomas.Tests/TypeDeclarationTests.fs +++ b/src/Fantomas.Tests/TypeDeclarationTests.fs @@ -237,7 +237,7 @@ let ``abstract and override keywords`` () = """ type MyClassBase1() = let mutable z = 0 - abstract member Function1 : int -> int + abstract member Function1: int -> int default u.Function1(a: int) = z <- z + a @@ -1005,7 +1005,7 @@ type ILogger = equal """ type ILogger = - abstract DebugFormat : format: String * [] args: Object [] -> unit + abstract DebugFormat: format: String * [] args: Object [] -> unit """ [] @@ -1022,8 +1022,8 @@ type A = equal """ type A = - abstract member M : int -> (int -> unit) - abstract member M : float -> int + abstract member M: int -> (int -> unit) + abstract member M: float -> int """ [] @@ -1040,8 +1040,8 @@ type A = equal """ type A = - abstract member M : (int -> int) -> unit - abstract member M : float -> int + abstract member M: (int -> int) -> unit + abstract member M: float -> int """ [] @@ -1058,7 +1058,7 @@ type Entity() = equal """ type Entity() = - abstract Id : int with get, set + abstract Id: int with get, set override val Id = 0 with get, set """ @@ -1317,10 +1317,10 @@ type Graph2dOptions = """ [] type Graph2dOptions = - abstract zoomMin : float option with get, set + abstract zoomMin: float option with get, set // abstract moment: MomentConstructor option with get, set - abstract maxHeight : HeightWidthType option with get, set - abstract zIndex : float option with get, set + abstract maxHeight: HeightWidthType option with get, set + abstract zIndex: float option with get, set """ [] @@ -1408,7 +1408,7 @@ type internal Blah = namespace Foo type internal Blah = - abstract Baz : unit + abstract Baz: unit """ [] @@ -1786,11 +1786,11 @@ type DataGroup = [] type SubGroupStackOptions = [] - abstract Item : name: string -> bool with get, set + abstract Item: name: string -> bool with get, set [] type DataGroup = - abstract className : string option with get, set + abstract className: string option with get, set """ [] @@ -1814,7 +1814,7 @@ let foo bar = zero [] type SubGroupStackOptions = [] - abstract Item : name: string -> bool with get, set + abstract Item: name: string -> bool with get, set [] let foo bar = zero @@ -1859,7 +1859,7 @@ type TimelineOptionsGroupEditableType = U2 [] type TimelineOptionsGroupCallbackFunction = [] - abstract Invoke : group: TimelineGroup * callback: (TimelineGroup option -> unit) -> unit + abstract Invoke: group: TimelineGroup * callback: (TimelineGroup option -> unit) -> unit type TimelineOptionsGroupEditableType = U2 """ @@ -1884,7 +1884,7 @@ let myBinding a = 7 [] type TimelineOptionsGroupCallbackFunction = [] - abstract Invoke : group: TimelineGroup * callback: (TimelineGroup option -> unit) -> unit + abstract Invoke: group: TimelineGroup * callback: (TimelineGroup option -> unit) -> unit let myBinding a = 7 """ diff --git a/src/Fantomas/CodePrinter.fs b/src/Fantomas/CodePrinter.fs index 352fd0ba66..729f203414 100644 --- a/src/Fantomas/CodePrinter.fs +++ b/src/Fantomas/CodePrinter.fs @@ -872,10 +872,10 @@ and genVal astContext (Val (ats, px, ao, s, identRange, t, vi, isInline, _) as n match node with | ValSpfn (_, _, synValTyparDecls, _, _, _, _, _, _, _, range) -> range, synValTyparDecls - let genericParams = + let genericParams, hasGenerics = match synValTyparDecls with - | SynValTyparDecls ([], _, _) -> sepNone - | SynValTyparDecls (tpd, _, cst) -> genTypeParamPostfix astContext tpd cst + | SynValTyparDecls ([], _, _) -> sepNone, false + | SynValTyparDecls (tpd, _, cst) -> genTypeParamPostfix astContext tpd cst, true let (FunType namedArgs) = (t, vi) @@ -887,7 +887,7 @@ and genVal astContext (Val (ats, px, ao, s, identRange, t, vi, isInline, _) as n -- s +> genericParams |> genTriviaFor Ident_ identRange) - +> sepColonWithSpacesFixed + +> ifElse hasGenerics sepColonWithSpacesFixed sepColon +> ifElse (List.isNotEmpty namedArgs) (autoIndentAndNlnIfExpressionExceedsPageWidth (genTypeList astContext namedArgs)) @@ -4052,6 +4052,8 @@ and genMemberSig astContext node = | TFun _ -> true | _ -> false + let hasGenerics = not tds.IsEmpty + genPreXmlDoc px +> genAttributes astContext ats +> genMemberFlagsForMemberBinding @@ -4063,7 +4065,7 @@ and genMemberSig astContext node = +> opt sepSpace ao genAccess +> ifElse (s = "``new``") (!- "new") (!-s) +> genTypeParamPostfix astContext tds tcs - +> sepColonWithSpacesFixed + +> ifElse hasGenerics sepColonWithSpacesFixed sepColon +> ifElse (List.isNotEmpty namedArgs) (autoIndentAndNlnIfExpressionExceedsPageWidth (genTypeList astContext namedArgs)) @@ -4784,12 +4786,13 @@ and genMemberDefn astContext node = | None -> sprintf "abstract %s" s |> fun s -> !- s ctx + let hasGenerics = not tds.IsEmpty genPreXmlDoc px +> genAttributes astContext ats +> opt sepSpace ao genAccess +> genAbstractMemberKeyword +> genTypeParamPostfix astContext tds tcs - +> sepColonWithSpacesFixed + +> ifElse hasGenerics sepColonWithSpacesFixed sepColon +> autoIndentAndNlnIfExpressionExceedsPageWidth (genTypeList astContext namedArgs) -- genPropertyKind (not isFunctionProperty) mk +> autoIndentAndNlnIfExpressionExceedsPageWidth (genConstraints astContext t vi)