Skip to content

-indent -rewrite can produce inparsable code for curried methods taking triple-quote arguments #21382

Closed
@WojciechMazur

Description

@WojciechMazur

Compiler version

All Scala 3.3+ versions

Minimized code

class Test:
  def test(name: String)(body: => Unit) = ???
  def check(element: Any)(expected: String): Unit = ???

  test("byte arrays"):
    check {
      ???
    }{
      """foo
      |bar""".stripMargin
    }
    // required additional line

Output

class Test:
  def test(name: String)(body: => Unit) = ???
  def check(element: Any)(expected: String): Unit = ???

  test("byte arrays"):
    check {
      ???
    }:
      """foo
      |bar""".stripMargin
    // required additional line
[error] ./test.scala:10:14
[error] end of statement expected but '.' found
[error]       |bar""".stripMargin
[error]              ^
[error] ./test.scala:6:5
[error] missing argument list for method check in class Test
[error] 
[error]   def check(element: Any)(expected: String): Unit

Expectation

Should either not rewrite that expression or compiler should be able to parse it

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions