Skip to content

add a compile error note for field name shadowing struct member function #705

@andrewrk

Description

@andrewrk
const xxx = struct {
    bar: u8,
    pub fn bar(self: *const xxx) void {}
};

pub fn main() !void {
    var x: xxx = undefined;
    x.bar();
}
O:\zig0.1.1\b.zig:10:4: error: type 'u8' not a function
  x.bar();
   ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSolving this issue will likely involve adding new logic or components to the codebase.error messageThis issue points out an error message that is unhelpful and should be improved.frontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions