Skip to content

False postfix error from parser #12395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
soronpo opened this issue May 10, 2021 · 0 comments · Fixed by #12400
Closed

False postfix error from parser #12395

soronpo opened this issue May 10, 2021 · 0 comments · Fixed by #12400

Comments

@soronpo
Copy link
Contributor

soronpo commented May 10, 2021

Compiler version

v3.0.0-RC3

Minimized code

@main def main : Unit = 
  val x = 1

  val y = x match 
    case 1 => 1
    case _ =>
      println("bad")
      ???
  println(x)

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

Output

postfix operator `???` needs to be enabled
by making the implicit value scala.language.postfixOps visible.
----
This can be achieved by adding the import clause 'import scala.language.postfixOps'
or by setting the compiler option -language:postfixOps.
See the Scaladoc for value scala.language.postfixOps for a discussion
why the feature needs to be explicitly enabled.

Expectation

No error. The compiler seems to be misreading the indentation of the last println.

odersky added a commit to dotty-staging/dotty that referenced this issue May 10, 2021
Don't assume that an operator `op` is a leading infix operator if
`op` appears on its own line, and next line is indented less.

Fixes scala#12395
michelou pushed a commit to michelou/scala3 that referenced this issue May 10, 2021
Don't assume that an operator `op` is a leading infix operator if
`op` appears on its own line, and next line is indented less.

Fixes scala#12395
@Kordyjan Kordyjan added this to the 3.0.1 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants