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

Completions for struct fields that are containers #1298

Merged

Conversation

llogick
Copy link
Contributor

@llogick llogick commented Jul 7, 2023

ZLS_sf_resolve1

Taking/Posting screenshots for this one would be impractical, so here's some code to give an idea what's covered:

const MyEnum = enum {
    ef1,
    ef2,
};
const oes = struct {
    const es = if (true) S1 else S2;
};
const es = switch (1) {
    1 => S1,
    2 => S2,
    3 => S3,
};
const S1 = struct { s1f1: u8, s1f2: u32 = 1, ref3: S3 = undefined };
const S2 = struct { s2f1: u8, s2f2: u32 = 1, ref1: S1, mye: MyEnum = .ef1};
const S3 = struct {
    s3f1: u8,
    s3f2: u32 = 1,
    ref2: S2,
    pub fn s3(p0: es, p1: S2) void {
        _ = p0;
        _ = p1;
    }
};
test {
    const refs = S3{ .ref2 = .{ .ref1 = .{ .ref3 = .{ .ref2 = .{ .ref1 = .{} } } } } };
    _ = refs;
    const esi: es = .{};
    _ = esi;
    const oesi: oes.es = .{ .mye = .{} };
    _ = oesi;
    S3.s3(.{.mye = .{}}, .{.ref1 = .{.ref3 = .{.ref2 = .{.ref1 = .{}}}}});
}

@leecannon leecannon merged commit c0f2acb into zigtools:master Jul 7, 2023
@llogick llogick deleted the compl-struct-fields-that-are-containers branch July 8, 2023 02:02
KoltPenny pushed a commit to KoltPenny/zls that referenced this pull request Oct 18, 2023
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.

2 participants