Skip to content

new indentation violating the off-side rule should error #10671

Open
@eed3si9n

Description

@eed3si9n

Minimized code

compile:

class Test:
  test("hello")
    assert(1 == 1)

  def test(name: String)(body: => Any) = ()

or more simply:

scala> def test(y: Int) =
     |   val x = 10
     |     x + y
     |
def test(y: Int): Int

Output

[warn] -- [E129] Potential Issue Warning: Test.scala:2:6
[warn] 2 |  test("hello")
[warn]   |  ^^^^^^^^^^^^^
[warn]   |A pure expression does nothing in statement position; you may be omitting necessary parentheses
[warn] one warning found

Expectation

Same as putting braces, no warnings should be printed.

[error]     test("hello")
[error] |    assert(1 == 1)
[error] |    ^^^^^^^^^^^^^^ 
[error] 🚩 Off-side rule violation. An indentation is started but the previous line does not end with a marker.

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