We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
3.0.0
object Test: class Foo: var buf = "" def add(v: String): Unit = buf += v @scala.annotation.targetName("addOp") inline def += (inline v: String): this.type = {add(v); this } def main(sa: Array[String]): Unit = var fooVar = new Foo fooVar += "a" += "b" += "c" println(fooVar.buf) // Prints: abc val fooVal = new Foo fooVal += "a" += "b" += "c" println(fooVal.buf) // Prints: c // Expected abc
If inlined method "+=" return type changed from "this.type" to Foo, the problem goes away.
The text was updated successfully, but these errors were encountered:
Don't forget side effects in prefixes of inlined function calls
c082e2d
Fixes scala#12829
6cfb318
odersky
Successfully merging a pull request may close this issue.
Compiler version
3.0.0
Minimized code
Problem
If inlined method "+=" return type changed from "this.type" to Foo, the problem goes away.
The text was updated successfully, but these errors were encountered: