Skip to content

Scala 3 regression of new-line braced block argument  #16760

@soronpo

Description

@soronpo

The following code works in Scala 2.13. In Scala 3 the braces {} (when appearing in a new line) are considered to be separate from the method call.

Compiler version

v3.2.2-RC2

Minimized code

https://scastie.scala-lang.org/UUJ5id94STydaoPDCkAQhQ

@main def main: Unit =
  def process(arg: Int)(block: => Unit): Int = arg
  val x = process(1) 
  {
  }
  println(x)

Output

warning:   A pure expression does nothing in statement position; you may be omitting necessary parentheses
main$package$$$Lambda$26822/0x00000008049bcc10@4f7a0b91

Expectation

Should print 1.

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