Skip to content

Formatter Breaks Explicit Partial Application Syntax When Split By a Line Break #6948

Closed
@LTibbetts

Description

@LTibbetts

The formatter is applying a trialing comma to the new explicit partial application function syntax which breaks compilation of otherwise compiling code. This only seems to happen when the line length is long enough to force a line break from the formatter.

Unformatted (Compiles)

module LongModuleName = {
  let functionWithAlongNameThatWrapsTheEditorToTheNextLine = (a: int): int =>
    a * 3 + 2
}

let mapWithAReallyLongName = (f: 'a => 'b, a: 'a) => {
  f(a)
}

let functionThatTakesThing =
  mapWithAReallyLongName(
    a => LongModuleName.functionWithAlongNameThatWrapsTheEditorToTheNextLine(a),
    ...
  )

let b = functionThatTakesThing(1)

Formatted (Syntax Error)

module LongModuleName = {
  let functionWithAlongNameThatWrapsTheEditorToTheNextLine = (a: int): int =>
    a * 3 + 2
}

let mapWithAReallyLongName = (f: 'a => 'b, a: 'a) => {
  f(a)
}

let functionThatTakesThing =
  mapWithAReallyLongName(
    a => LongModuleName.functionWithAlongNameThatWrapsTheEditorToTheNextLine(a),
-    ...
+    ...,
  )

let b = functionThatTakesThing(1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions