Skip to content

Wrong indent rewrite with certain unusually braced scopes #20001

Open
@OndrejSpanel

Description

@OndrejSpanel

Compiler version

3.4.1-RC2

Minimized code

Use "-indent", "-rewrite" on following code:

def signedArea = {
  var i = 0
  while (i < 3) {
    {
      println(i)
    }
    i += 1
  }
}

Output

def signedArea =
  var i = 0
  while (i < 3)
      println(i)
    i += 1

The result of the rewrite does not compile, the error is:

C:\Dev\Sandbox\src\main\scala\Main.scala:5:5
The start of this line does not match any of the previous indentation widths.
Indentation width of current line : 4 spaces
This falls between previous widths: 2 spaces and 6 spaces
i += 1

Expectation

The output of "-indent", "-rewrite" should be buildable

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