Skip to content

Compiler incorrectly detects dependency loop when using @typeInfo(@This()) in test #4476

@SpexGuy

Description

@SpexGuy

Minimal Repro (tested with 0.5.0 compiler) :

const DrawCallback = fn (cmd: *DrawCmd) void;

const DrawCmd = struct {
    UserCallback: DrawCallback,
};

test "bork" {
    //var x: DrawCmd = undefined;
    _ = @typeInfo(@This());
}

Compiling this yields this error:

C:\bork.zig:4:19: error: dependency loop detected
 C:\bork.zig:1:22: note: referenced here
 C:\bork.zig:1:1: note: referenced here
 C:\bork.zig:9:9: note: referenced here

If I uncomment the first line in the test block, the program compiles successfully.

(edit: even more minimal test case)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstage1The process of building from source via WebAssembly and the C backend.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions