Skip to content

Space before should not be introduced for index expression #2965

@nojaf

Description

@nojaf

Issue created from fantomas-online

Code

type Foo() =
    member _.Bar () = dict [ "a", "a" ]

let key = "a"
let fooo = Foo()
fooo.Bar()[key]

Result

type Foo() =
    member _.Bar() = dict [ "a", "a" ]

let key = "a"
let fooo = Foo ()
fooo.Bar ()[key]

Problem description

Produces warning FS3369: The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'.

Extra information

  • The formatted result breaks my code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.
  • I would like a release if this problem is solved.

Options

Fantomas main branch at 2023-10-18T10:31:27Z - dfc886f

    { config with
                SpaceBeforeUppercaseInvocation = true }

Did you know that you can ignore files when formatting by using a .fantomasignore file?
PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions