diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ea411c9c..86d99880a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - NamedIndexedPropertySet with two SynLongIdent removed space. [#3273](https://github.com/fsprojects/fantomas/issues/3273) - `%%` (double-percent) infix operator moved to new line, producing invalid F#. [#2107](https://github.com/fsprojects/fantomas/issues/2107) - Indentation warning when formatting `match` with long anonymous record discriminant. [#1903](https://github.com/fsprojects/fantomas/issues/1903) +- Index-without-dot with variable key followed by unit arguments added spurious spaces, e.g. `dict[key] () ()` became `dict [ key ] () ()`. [#2519](https://github.com/fsprojects/fantomas/issues/2519) ## [8.0.0-alpha-007] - 2026-03-10 diff --git a/src/Fantomas.Core.Tests/IndexSyntaxTests.fs b/src/Fantomas.Core.Tests/IndexSyntaxTests.fs index 872892f77..9372b4b46 100644 --- a/src/Fantomas.Core.Tests/IndexSyntaxTests.fs +++ b/src/Fantomas.Core.Tests/IndexSyntaxTests.fs @@ -315,3 +315,22 @@ prepConfigs[ 1 ] host days """ prepConfigs[1] host days """ + +[] +let ``index without dot with variable key followed by two unit arguments, 2519`` () = + formatSourceString + """ +let test (dict: System.Collections.Generic.IDictionary unit -> unit>) = + let key = "foo" + dict[key] () () +""" + config + |> prepend newline + |> should + equal + """ +let test (dict: System.Collections.Generic.IDictionary unit -> unit>) = + let key = "foo" + dict[key] () () +""" +