Skip to content

incorrect "error: dependency loop detected" #16419

@buzmeg

Description

@buzmeg

Zig Version

0.11.0-dev.3952+82a9d5d78

Steps to Reproduce and Observed Behavior

The following code refuses to compile on 0.11.0-dev.3952+82a9d5d78 but compiles just fine on Godbolt on 0.10.0. So, the dependency loop error if presumably false.

src/main.zig:16:1: error: dependency loop detected
const ContinuationStackType = std.BoundedArray(SmolkContinuationNative, MAX_CONTINUATION_STACK_SIZE);
const std = @import("std");


const KO_Ref = u16;
const KO_State = u16;

const KOErr = error {
    GENERIC,
};


const MAX_CONTINUATION_STACK_SIZE = 8;



const ContinuationStackType = std.BoundedArray(SmolkContinuationNative, MAX_CONTINUATION_STACK_SIZE);
var kont_continuation_stack: ContinuationStackType = .{};

const SmolkPointerContinuationFunction = *const fn (pkos: *KO_State, kont_stack: *ContinuationStackType, args: SmolkContinuationNative) KOErr!SmolkContinuationNative;

const SMOLK_CONTINUATION_INITIAL_CALL_STATE = 1;

const SmolkContinuationNative = struct {
    pcfn: SmolkPointerContinuationFunction,
    kor_result: KO_Ref,
};


pub fn kont_fail(pkos: *KO_State, kont_stack: *ContinuationStackType, args: SmolkContinuationNative) KOErr!SmolkContinuationNative
{
    _ = pkos;
    _ = kont_stack;
    _ = args;

    std.debug.print("FAIL!\n", .{});

    return KOErr.GENERIC;
}

pub fn main() !void {
    try kont_continuation_stack.append(.{
        .pcfn = kont_fail,
        .kor_result = 0,
    });
    std.debug.print("Stack: {any}\n", .{kont_continuation_stack});
}

Expected Behavior

Expected to compile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions