Skip to content

Inheritance on self doesn't work right in default methods #3979

Description

@catamorphism

This should work:

trait Positioned {
fn SetX(int);
}
trait Movable: Positioned {
fn translate(dx: int) {
self.SetX(self.X() + dx);
}
}

It fails to typecheck:

src/test/run-pass/issue-2616.rs:13:4: 13:13 error: attempted access of field `SetX` on type `self`,
but no field or method with that name was found
/Users/tchevalier/rust2/src/test/run-pass/issue-2616.rs:13 self.SetX(self.X() + dx);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions