#zig build-obj {
--name test -fno-emit-bin
-Mroot=test.zig
#}

#write test.zig {
export fn testVoid() void {
    const f: void = @import("neg_inf.zon");
    _ = f;
}

export fn testInStruct() void {
    const f: struct { f: [*]const u8 } = @import("neg_inf.zon");
    _ = f;
}

export fn testError() void {
    const f: struct { error{foo} } = @import("neg_inf.zon");
    _ = f;
}

export fn testInUnion() void {
    const f: union(enum) { a: void, b: [*c]const u8 } = @import("neg_inf.zon");
    _ = f;
}

export fn testInVector() void {
    const f: @Vector(0, [*c]const u8) = @import("neg_inf.zon");
    _ = f;
}

export fn testInOpt() void {
    const f: *const ?[*c]const u8 = @import("neg_inf.zon");
    _ = f;
}

export fn testComptimeField() void {
    const f: struct { comptime foo: ??u8 = null } = @import("neg_inf.zon");
    _ = f;
}

export fn testEnumLiteral() void {
    const f: @TypeOf(.foo) = @import("neg_inf.zon");
    _ = f;
}

export fn testNestedOpt1() void {
    const f: ??u8 = @import("neg_inf.zon");
    _ = f;
}

export fn testNestedOpt2() void {
    const f: ?*const ?u8 = @import("neg_inf.zon");
    _ = f;
}

export fn testNestedOpt3() void {
    const f: *const ?*const ?*const u8 = @import("neg_inf.zon");
    _ = f;
}

export fn testOpt() void {
    const f: ?u8 = @import("neg_inf.zon");
    _ = f;
}

const E = enum(u8) { _ };
export fn testNonExhaustiveEnum() void {
    const f: E = @import("neg_inf.zon");
    _ = f;
}

const U = union { foo: void };
export fn testUntaggedUnion() void {
    const f: U = @import("neg_inf.zon");
    _ = f;
}

const EU = union(enum) { foo: void };
export fn testTaggedUnionVoid() void {
    const f: EU = @import("neg_inf.zon");
    _ = f;
}

export fn testVisited() void {
    const V = struct {
        ?f32, // Adds `?f32` to the visited list
        ??f32, // `?f32` is already visited, we need to detect the nested opt anyway
        f32,
    };
    const f: V = @import("neg_inf.zon");
    _ = f;
}

export fn testMutablePointer() void {
    const f: *i32 = @import("neg_inf.zon");
    _ = f;
}
#}
#write neg_inf.zon "-inf"
#update
#check errors {
neg_inf.zon:1:1: error: expected type '?u8'
test.zig:57:28: note: imported here
neg_inf.zon:1:1: error: expected type '@EnumLiteral()'
test.zig:37:38: note: imported here
neg_inf.zon:1:1: error: expected type 'test.E'
test.zig:63:26: note: imported here
neg_inf.zon:1:1: error: expected type 'test.EU'
test.zig:75:27: note: imported here
neg_inf.zon:1:1: error: expected type 'test.U'
test.zig:69:26: note: imported here
test.zig:2:29: error: type 'void' is not available in ZON
test.zig:7:50: error: type '[*]const u8' is not available in ZON
test.zig:7:50: note: ZON does not allow many-pointers
test.zig:12:46: error: type 'error{foo}' is not available in ZON
test.zig:17:65: error: type '[*c]const u8' is not available in ZON
test.zig:17:65: note: ZON does not allow C pointers
test.zig:22:49: error: type '[*c]const u8' is not available in ZON
test.zig:22:49: note: ZON does not allow C pointers
test.zig:27:45: error: type '[*c]const u8' is not available in ZON
test.zig:27:45: note: ZON does not allow C pointers
test.zig:32:61: error: type '??u8' is not available in ZON
test.zig:32:61: note: ZON does not allow nested optionals
test.zig:42:29: error: type '??u8' is not available in ZON
test.zig:42:29: note: ZON does not allow nested optionals
test.zig:47:36: error: type '?*const ?u8' is not available in ZON
test.zig:47:36: note: ZON does not allow nested optionals
test.zig:52:50: error: type '?*const ?*const u8' is not available in ZON
test.zig:52:50: note: ZON does not allow nested optionals
test.zig:85:26: error: type '??f32' is not available in ZON
test.zig:85:26: note: ZON does not allow nested optionals
test.zig:90:29: error: type '*i32' is not available in ZON
test.zig:90:29: note: ZON does not allow mutable pointers
#}
