-
Notifications
You must be signed in to change notification settings - Fork 21
this qualified field masked by argument #3194
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-3194?orig=1 |
@odersky said: |
@paulp said:
That's fine - there's no ticket I open these days intending it to be addressed before 2.8 unless it involves planes falling out of the sky. I only open them so I don't forget. |
@paulp said: trait Settings {
type T = Int
def f: T = 5
}
class Bar(val settings: Settings) { }
class Foo(settings: Settings) extends Bar(settings) {
def g = settings.f
} a.scala:9: error: private value settings escapes its defining scope as part of type Foo.this.settings.T
def g = settings.f
^
one error found |
@paulp said:
Now that #3861 is fixed, as one might suppose, the workaround no longer works around. // This code compiles in 2.8.1 but not since whenever SI-3861 was fixed
// (tested at r24303.)
class A(var x: Int)
class B(x: Int) extends A(x) {
self: A =>
def update(z: Int) = this.x = z
} |
The limited fix is in the linked PR. We are safely past 2.8 final, so the risk of the change is deemed acceptable. There are variants mentioned here that are worth revisiting. |
I can't say definitively this is a bug. But I think it should be. There is only one thing which "this.x" can mean. It looks to me like this could be implemented with some extra logic in typedAssign.
I would expect it to work like the common situation (common in java anyway) where one does:
The text was updated successfully, but these errors were encountered: