Skip to content

this qualified field masked by argument #3194

Closed
scala/scala
#8558
@scabug

Description

@scabug

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.

class A(var x: Int)
class B(x: Int) extends A(x) { def update(z: Int) = this.x = z }
a.scala:2: error: reassignment to val
class B(x: Int) extends A(x) { def update(z: Int) = this.x = z }
                                                           ^
one error found

I would expect it to work like the common situation (common in java anyway) where one does:

def f(x: Int) = this.x = x

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions