mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
seriously don't put internpool indexes in test cases
This commit is contained in:
parent
f088bb0d6e
commit
2e31544285
@ -1,125 +0,0 @@
|
|||||||
export fn testVoid() void {
|
|
||||||
const f: void = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testInStruct() void {
|
|
||||||
const f: struct { f: [*]const u8 } = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testError() void {
|
|
||||||
const f: struct { error{foo} } = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testInUnion() void {
|
|
||||||
const f: union(enum) { a: void, b: [*c]const u8 } = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testInVector() void {
|
|
||||||
const f: @Vector(0, [*c]const u8) = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testInOpt() void {
|
|
||||||
const f: *const ?[*c]const u8 = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testComptimeField() void {
|
|
||||||
const f: struct { comptime foo: ??u8 = null } = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testEnumLiteral() void {
|
|
||||||
const f: @TypeOf(.foo) = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testNestedOpt1() void {
|
|
||||||
const f: ??u8 = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testNestedOpt2() void {
|
|
||||||
const f: ?*const ?u8 = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testNestedOpt3() void {
|
|
||||||
const f: *const ?*const ?*const u8 = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testOpt() void {
|
|
||||||
const f: ?u8 = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testNonExhaustiveEnum() void {
|
|
||||||
const f: enum(u8) { _ } = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testUntaggedUnion() void {
|
|
||||||
const f: union { foo: void } = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testTaggedUnionVoid() void {
|
|
||||||
const f: union(enum) { foo: void } = @import("zon/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("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn testMutablePointer() void {
|
|
||||||
const f: *i32 = @import("zon/neg_inf.zon");
|
|
||||||
_ = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// error
|
|
||||||
// imports=zon/neg_inf.zon
|
|
||||||
//
|
|
||||||
// tmp.zig:2:29: error: type 'void' is not available in ZON
|
|
||||||
// tmp.zig:7:50: error: type '[*]const u8' is not available in ZON
|
|
||||||
// tmp.zig:7:50: note: ZON does not allow many-pointers
|
|
||||||
// tmp.zig:12:46: error: type 'error{foo}' is not available in ZON
|
|
||||||
// tmp.zig:17:65: error: type '[*c]const u8' is not available in ZON
|
|
||||||
// tmp.zig:17:65: note: ZON does not allow C pointers
|
|
||||||
// tmp.zig:22:49: error: type '[*c]const u8' is not available in ZON
|
|
||||||
// tmp.zig:22:49: note: ZON does not allow C pointers
|
|
||||||
// tmp.zig:27:45: error: type '[*c]const u8' is not available in ZON
|
|
||||||
// tmp.zig:27:45: note: ZON does not allow C pointers
|
|
||||||
// tmp.zig:32:61: error: type '??u8' is not available in ZON
|
|
||||||
// tmp.zig:32:61: note: ZON does not allow nested optionals
|
|
||||||
// tmp.zig:42:29: error: type '??u8' is not available in ZON
|
|
||||||
// tmp.zig:42:29: note: ZON does not allow nested optionals
|
|
||||||
// tmp.zig:47:36: error: type '?*const ?u8' is not available in ZON
|
|
||||||
// tmp.zig:47:36: note: ZON does not allow nested optionals
|
|
||||||
// tmp.zig:52:50: error: type '?*const ?*const u8' is not available in ZON
|
|
||||||
// tmp.zig:52:50: note: ZON does not allow nested optionals
|
|
||||||
// tmp.zig:82:26: error: type '??f32' is not available in ZON
|
|
||||||
// tmp.zig:82:26: note: ZON does not allow nested optionals
|
|
||||||
// tmp.zig:87:29: error: type '*i32' is not available in ZON
|
|
||||||
// tmp.zig:87:29: note: ZON does not allow mutable pointers
|
|
||||||
// neg_inf.zon:1:1: error: expected type '@Type(.enum_literal)'
|
|
||||||
// tmp.zig:37:38: note: imported here
|
|
||||||
// neg_inf.zon:1:1: error: expected type '?u8'
|
|
||||||
// tmp.zig:57:28: note: imported here
|
|
||||||
// neg_inf.zon:1:1: error: expected type 'tmp.testNonExhaustiveEnum__enum_525'
|
|
||||||
// tmp.zig:62:39: note: imported here
|
|
||||||
// neg_inf.zon:1:1: error: expected type 'tmp.testUntaggedUnion__union_527'
|
|
||||||
// tmp.zig:67:44: note: imported here
|
|
||||||
// neg_inf.zon:1:1: error: expected type 'tmp.testTaggedUnionVoid__union_530'
|
|
||||||
// tmp.zig:72:50: note: imported here
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
const S = struct {
|
|
||||||
fn foo(b: u32, c: anytype) void {
|
|
||||||
const C = struct {
|
|
||||||
c: @TypeOf(c),
|
|
||||||
b: u32,
|
|
||||||
};
|
|
||||||
bar(C{ .c = c, .b = b });
|
|
||||||
}
|
|
||||||
fn bar(_: anytype) void {}
|
|
||||||
};
|
|
||||||
pub export fn entry() void {
|
|
||||||
S.foo(0, u32);
|
|
||||||
}
|
|
||||||
|
|
||||||
// error
|
|
||||||
//
|
|
||||||
// :7:25: error: unable to resolve comptime value
|
|
||||||
// :7:25: note: initializer of comptime-only struct 'tmp.S.foo__anon_499.C' must be comptime-known
|
|
||||||
// :4:16: note: struct requires comptime because of this field
|
|
||||||
// :4:16: note: types are not available at runtime
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
var self = "aoeu";
|
|
||||||
fn f(m: []const u8) void {
|
|
||||||
m.copy(u8, self[0..], m);
|
|
||||||
}
|
|
||||||
export fn entry() usize {
|
|
||||||
return @sizeOf(@TypeOf(&f));
|
|
||||||
}
|
|
||||||
pub export fn entry1() void {
|
|
||||||
.{}.bar();
|
|
||||||
}
|
|
||||||
pub export fn entry2() void {
|
|
||||||
.{ .foo = 1 }.bar();
|
|
||||||
}
|
|
||||||
|
|
||||||
// error
|
|
||||||
//
|
|
||||||
// :3:6: error: no field or member function named 'copy' in '[]const u8'
|
|
||||||
// :9:8: error: no field or member function named 'bar' in '@TypeOf(.{})'
|
|
||||||
// :12:18: error: no field or member function named 'bar' in 'tmp.entry2__struct_503'
|
|
||||||
// :12:6: note: struct declared here
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
const T = struct { x: u32 };
|
|
||||||
export fn foo() void {
|
|
||||||
const a = .{ .x = 123 };
|
|
||||||
_ = @as(T, a);
|
|
||||||
}
|
|
||||||
|
|
||||||
// error
|
|
||||||
//
|
|
||||||
// :4:16: error: expected type 'tmp.T', found 'tmp.foo__struct_492'
|
|
||||||
// :3:16: note: struct declared here
|
|
||||||
// :1:11: note: struct declared here
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
const S = struct { x: u32 = 0 };
|
|
||||||
const T = struct { []const u8 };
|
|
||||||
|
|
||||||
fn test0() !void {
|
|
||||||
const x: u8 = try 1;
|
|
||||||
_ = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn test1() !void {
|
|
||||||
const x: S = try .{};
|
|
||||||
_ = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn test2() !void {
|
|
||||||
const x: S = try .{ .x = 123 };
|
|
||||||
_ = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn test3() !void {
|
|
||||||
const x: S = try try .{ .x = 123 };
|
|
||||||
_ = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn test4() !void {
|
|
||||||
const x: T = try .{"hello"};
|
|
||||||
_ = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn test5() !void {
|
|
||||||
const x: error{Foo}!u32 = 123;
|
|
||||||
_ = try try x;
|
|
||||||
}
|
|
||||||
|
|
||||||
comptime {
|
|
||||||
_ = &test0;
|
|
||||||
_ = &test1;
|
|
||||||
_ = &test2;
|
|
||||||
_ = &test3;
|
|
||||||
_ = &test4;
|
|
||||||
_ = &test5;
|
|
||||||
}
|
|
||||||
|
|
||||||
// error
|
|
||||||
//
|
|
||||||
// :5:23: error: expected error union type, found 'comptime_int'
|
|
||||||
// :10:23: error: expected error union type, found '@TypeOf(.{})'
|
|
||||||
// :15:23: error: expected error union type, found 'tmp.test2__struct_529'
|
|
||||||
// :15:23: note: struct declared here
|
|
||||||
// :20:27: error: expected error union type, found 'tmp.test3__struct_531'
|
|
||||||
// :20:27: note: struct declared here
|
|
||||||
// :25:23: error: expected error union type, found 'struct { comptime *const [5:0]u8 = "hello" }'
|
|
||||||
// :31:13: error: expected error union type, found 'u32'
|
|
||||||
Loading…
x
Reference in New Issue
Block a user