Skip to content
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

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

Closed
KacperFKorban opened this issue Jul 13, 2022 · 3 comments

Comments

@KacperFKorban
Copy link
Member

KacperFKorban commented Jul 13, 2022

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)

@odersky
Copy link
Contributor

odersky commented Jul 13, 2022

I am not sure we want to fix this. In fact I think rather not.

@odersky odersky removed the stat:needs triage Every issue needs to have an "area" and "itype" label label Jul 13, 2022
@som-snytt
Copy link
Contributor

Related issue where beloved end marker interacts with expression.

#15011

I hope to come up with a mnemonic like My Dear Aunt Sally but for end markers.

@odersky
Copy link
Contributor

odersky commented Jul 14, 2022

Workaround:

start
+ end

@griggt griggt closed this as not planned Won't fix, can't repro, duplicate, stale Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants