Skip to content

Leading infix with parens broken? #25250

@kitbellew

Description

@kitbellew

Compiler version

3.8.1

Minimized code

//> using scala 3.8.1
//> using options -Wall -Werror
//> using dep com.outr::scribe:3.16.1

@main def test = {
  System.out.println(Seq(res1, res2, res3, res4, res5).mkString("\n"))
}

def fooB(b: Int) = b * b
def fooC(c: Int) = c * c * c

// compiles
val res1 = fooB(
  b =
    fooC:
      2
    + 1
)
val res2 = fooB:
  fooC:
    2
  + 1
val res3 = fooB(
    fooC(2)
    + 1
)

// doesn't compile
val res4 = fooB(
  fooC:
    2
  + 1
)
val res5 = fooB(
  b = fooC:
    2
  + 1
)

Output

error:

`)` expected but `identifier` found

Expectation

81
81
81
81
81

Other

Reported as scalameta/scalafmt#5217.

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