-
Notifications
You must be signed in to change notification settings - Fork 21
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
Cannot override var setters in sub-class of sub-class - "error overriding variable … cannot override a mutable variable" #12472
Comments
please report Scala 3 bugs at https://github.com/lampepfl/dotty/issues |
sorry, I keep forgetting that the bug trackers are still separate |
no worries 😀 |
That would be a dotty feature-request. |
I don't understand why it is a feature request. This works fine in Scala 2, and it is not comprehensible why if I define the trait Scope {
var logFreq: Boolean
var logFreqMin: Double
... etc to trait Scope {
def logFreq: Boolean
def logFreq_=(value: Boolean): Unit
def logFreqMin: Double
def logFreqMin_(value: Double): Unit
... etc purely defensively and in order to later implement that thing. I shouldn't need to change API definitions based on how the implementations (perhaps even in other libraries) are going. The duplicate issue you link to is very old imported from 2016 bug tracker and closed without resolution. Voting to re-open this issue. |
IDK offhand, but I assumed it has to do with whether a field is allocated. Just analyzing aliased member fields is hard, but impossible with overridden accessors? Just guessing, and I'm not an expert. |
The issue is open (in the right tracker): scala/scala3#13738 |
🤦 I'll get this eventually |
I was saying it's the wrong tracker, it should be a feature request. :) |
Sorry, somehow I missed that the var is abstract here. I fixed the dotty issue under a different ticket after 3.1.0. |
reproduction steps
using Scala 3.0.2,
If I rewrite Top as
"it works"
problem
I think it should always be possible to override getters and setters for a
var
.The text was updated successfully, but these errors were encountered: