Skip to content

false dependency loop in struct definition #679

Closed
@AndreaOrru

Description

@AndreaOrru
pub fn List(comptime T: type) type {
    return u32;
}

const ElementList = List(Element);
const Element = struct {
    link: ElementList,
};

export fn entry() void {
    const listType = ElementList;
}
/home/andrea/Programming/test4.zig:5:1: error: 'ElementList' depends on itself
const ElementList = List(Element);

But if we just expand ElementList once inside Element, the dependency loop goes away.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions