-
Notifications
You must be signed in to change notification settings - Fork 21
problem with @specialized case class if constructor writes to private var #4962
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4962?orig=1 |
@non said (edited on Feb 21, 2012 5:05:40 AM UTC): You can easily see this by diffing the output of -Xprint:tailcalls between a version using private[this] and a version using private: 11c11,13
< def read(): T = Cell.this.v;
---
> private <accessor> def v(): T = Cell.this.v;
> private <accessor> def v_=(x$1: T): Unit = Cell.this.v = x$1;
> def read(): T = Cell.this.v(); I'm not sure what the best way to handle this is. I guess we could try to explicitly call the methods which would create the accessors, and then manually rewrite field access to use them? The tough thing is that the logic about which methods will need to be specialized is (currently) quite complicated, so we can't easily move the rewriting code into an earlier phase. What seems best? |
@non said: I am not endorsing this idea, but it seems a lot easier than correctly creating/using accessors after the fact, or correctly determining which members will need to be specialized on early enough. |
@paulp said: |
Fixed in 2.11.0 |
Result should be 7, not 0. Error is not specific to repl. There is no error if one uses
private
instead ofprivate[this]
and it has to be a case class.The text was updated successfully, but these errors were encountered: