Skip to content

Fewer braces breaks rewrites #17413

Open
Open
@ckipp01

Description

@ckipp01

Compiler version

3.3.1-RC1-bin-20230503-b8d2966-NIGHTLY

Minimized code

//> using scala "3.nightly"
//> using options "-old-syntax", "-rewrite"


@main def run() = {
  List(1, 2, 3).map: num =>
    num * 2
}

Output

[error] ./main.scala:6:3
[error] not a legal formal parameter for a function literal
[error]   List(1, 2, 3).map: num =>
[error]   ^^^^^^^^^^^^^^^^^^^^^^
[error] ./main.scala:7:5
[error] Not found: num
[error]     num * 2
[error]     ^^^

Expectation

I'd expect to be able to compile this code and get it re-written to the old syntax.

I'm not sure if this was overlooked or just never taken into account, but I consider this a pretty serious regression. With fewer braces entering the real world in 3.3.0, we'll be introducing code that cannot be rewritten by the compiler to the old syntax.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions