Skip to content

[Repo Assist] Add regression test for index-without-dot with variable key and unit arguments, 2519#3310

Closed
github-actions[bot] wants to merge 1 commit intomainfrom
repo-assist/regression-test-2519-index-without-dot-unit-args-8126b6a99a487efc
Closed

[Repo Assist] Add regression test for index-without-dot with variable key and unit arguments, 2519#3310
github-actions[bot] wants to merge 1 commit intomainfrom
repo-assist/regression-test-2519-index-without-dot-unit-args-8126b6a99a487efc

Conversation

@github-actions
Copy link
Contributor

🤖 This is an automated PR from Repo Assist.

Closes #2519

Summary

Adds a regression test for the specific scenario reported in issue #2519: an index-without-dot expression using a variable key, followed by two unit arguments, was being formatted with spurious spaces:

// Before fix (wrong):
dict [ key ] () ()

// After fix (correct):
dict[key] () ()

This was fixed by PR #3259 ("Fix index-without-dot followed by application arguments"). The test ensures this specific pattern from the issue report stays correctly formatted.

Test Added

In IndexSyntaxTests.fs:

[(Test)]
let ``index without dot with variable key followed by two unit arguments, 2519`` () =
    formatSourceString
        """
let test (dict: System.Collections.Generic.IDictionary(string, unit -) unit -> unit>) =
    let key = "foo"
    dict[key] () ()
"""
        config
    |> prepend newline
    |> should
        equal
        """
let test (dict: System.Collections.Generic.IDictionary(string, unit -) unit -> unit>) =
    let key = "foo"
    dict[key] () ()
"""

A CHANGELOG entry has also been added to the [Unreleased] section as requested.

Test Status

  • ✅ Build succeeded (dotnet build fantomas.sln)
  • ✅ All 2740 tests pass (dotnet test src/Fantomas.Core.Tests/ --no-build)
  • ✅ New test passes as expected

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@d1d884596e62351dd652ae78465885dd32f0dd7d

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@4957663821dbb3260348084fa2f1659701950fef

…args, 2519

Add a regression test for the specific scenario from issue #2519: using
a variable as the index key followed by unit arguments should not add
spurious spaces around the index.

The bug was fixed by PR #3259 (Fix index-without-dot followed by
application arguments). This test ensures the specific pattern
reported in #2519 remains correctly formatted.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fantomas inserts space that breaks index lookups (without a dot)

1 participant