Skip to content

Confusing error when trying to find a self method in a FacetType. #6097

@danakj

Description

@danakj

Description of the bug:

When we try to call a method with self on a facet type, with the same syntax we would use to call a method without self:

interface I {
  let X:! type;
  fn I1() -> X;
  fn I2[self: Self]() -> X;
}

fn F(U:! I where .X = .Self, v: U) {
  U.(I.I1)();
  U.(I.I2)();
}

The problem is it needs a self value of type U. But instead we get this confusing error message:

<source>:9:3: error: cannot access member of interface `I` in type `I where .(I.X) = .Self` that does not implement that interface
  U.(I.I2)();
  ^~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions