Aladdin - Scala Bugtracking
[#751] project: specification priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin open 2006-09-24 16:10:31.0
subject [contrib #202] "this" allows accessing non-members
code
class A(val x: Int);
class B(x: Int) extends A(x + 1) {def foo = Console.println("" + this.x)};
object Foo {def main(args: Array[String]) = { new B(1).foo; }}
what happened
1
what expected 2 // this.x should return 2 (super.x), the x parameter of B should not be accessible with this.x, for the same reason the following is invalid: class C(x: Int); new C(1).x
[back to overview]
Changes of this bug report
Nikolay  edited on  2006-09-24 16:11:19.0
Transferred from the contributions and assigned to Martin.
Martin  edited on  2006-10-31 11:38:04.0
We might want to specify that `x' is a member, but a local one. That's what the compiler implements. I am not sure what to do here yet.