Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sema: Don't ignore current declaration if it's not ambiguous #19786

Conversation

akarpovskii
Copy link

This fixes #17872.

Previous logic was introduced in c17793b by @Vexu to address issue #12429. For the following piece of code there's no ambiguity and no reason to ignore the only declaration.

pub const Example = struct {
    usingnamespace struct {}; // works without this line

    pub fn foo() void {
        _ = Example.foo;  // error: struct 'main.Example' has no member named 'foo'
    }
};

pub fn main() !void {
    Example.foo();
}

@andrewrk
Copy link
Member

I'm sorry, this will need to be reworked after some recent changes to the way usingnamespace works (there are conflicts). Also note the existence of #20663, which is proposed but not yet accepted or rejected.

@andrewrk andrewrk closed this Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Function not visible inside itself through generic struct with usingnamespace
2 participants