Skip to content

Member functions are not recognized when they contain a literal type parameter #2380

@InspectorBoat

Description

@InspectorBoat

Zig Version

0.15.0-dev.877+0adcfd60f

ZLS Version

0.15.0-dev.247+7ab5a7ad

Client / Code Editor / Extensions

vscode

Steps to Reproduce and Observed Behavior

comptime {
    var qux: Bar = undefined;
    qux.baz(); // <-- not recognized as a member function
}

const Bar = struct {
    pub fn baz(_: *@This(), _: type) void {}
};

Expected Behavior

qux.baz should be recognized as a member function.
If the parameter in baz is changed from the literal type to an alias, e.g:

comptime {
    var qux: Bar = undefined;
    qux.baz(); // <-- this now works
}

const Bar = struct {
    const X = type;
    pub fn baz(_: *@This(), _: X) void {}
};

qux.baz is now recognized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions