Skip to content

val named "end" interpreted as end marker when used as the last argument to a multi-line operator application #15668

Closed as not planned
@KacperFKorban

Description

@KacperFKorban

Compiler version

Works for 3.0.0
Gives an error for 3.0.1, ..., 3.2.0-RC1, 3.2.1-RC1-bin-20220712-7e20b81-NIGHTLY

Minimized code

def fun = {
  val start = ""
  val end = ""
  start +
    end
}

Output

From 3.1.3:

[error] ./main.scala:6:10: expression expected but end of statement found
[error]   start +
[error]          ^

Until 3.1.2:

[error] ./main.scala:6:3: postfix operator `+` needs to be enabled
[error] by making the implicit value scala.language.postfixOps visible.
[error] ----
[error] This can be achieved by adding the import clause 'import scala.language.postfixOps'
[error] or by setting the compiler option -language:postfixOps.
[error] See the Scaladoc for value scala.language.postfixOps for a discussion
[error] why the feature needs to be explicitly enabled.
[error]   start +
[error]   ^^^^^

Expectation

Should compile correctly, parse the expression in block to start.+(end)

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