authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-06-07 12:42:03-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-06-07 12:42:03-07:00
log2e3154428501d745f3f6e6e67231420cadb43bb4
tree9ed793bca645d292683b11a3271883e1b2cf6aa6
parentf088bb0d6e3ef439958e53e526902cbc0a11c597

seriously don't put internpool indexes in test cases


5 files changed, 0 insertions(+), 228 deletions(-)

test/cases/compile_errors/@import_zon_bad_type.zig deleted-125
......@@ -1,125 +0,0 @@
1export fn testVoid() void {
2 const f: void = @import("zon/neg_inf.zon");
3 _ = f;
4}
5
6export fn testInStruct() void {
7 const f: struct { f: [*]const u8 } = @import("zon/neg_inf.zon");
8 _ = f;
9}
10
11export fn testError() void {
12 const f: struct { error{foo} } = @import("zon/neg_inf.zon");
13 _ = f;
14}
15
16export fn testInUnion() void {
17 const f: union(enum) { a: void, b: [*c]const u8 } = @import("zon/neg_inf.zon");
18 _ = f;
19}
20
21export fn testInVector() void {
22 const f: @Vector(0, [*c]const u8) = @import("zon/neg_inf.zon");
23 _ = f;
24}
25
26export fn testInOpt() void {
27 const f: *const ?[*c]const u8 = @import("zon/neg_inf.zon");
28 _ = f;
29}
30
31export fn testComptimeField() void {
32 const f: struct { comptime foo: ??u8 = null } = @import("zon/neg_inf.zon");
33 _ = f;
34}
35
36export fn testEnumLiteral() void {
37 const f: @TypeOf(.foo) = @import("zon/neg_inf.zon");
38 _ = f;
39}
40
41export fn testNestedOpt1() void {
42 const f: ??u8 = @import("zon/neg_inf.zon");
43 _ = f;
44}
45
46export fn testNestedOpt2() void {
47 const f: ?*const ?u8 = @import("zon/neg_inf.zon");
48 _ = f;
49}
50
51export fn testNestedOpt3() void {
52 const f: *const ?*const ?*const u8 = @import("zon/neg_inf.zon");
53 _ = f;
54}
55
56export fn testOpt() void {
57 const f: ?u8 = @import("zon/neg_inf.zon");
58 _ = f;
59}
60
61export fn testNonExhaustiveEnum() void {
62 const f: enum(u8) { _ } = @import("zon/neg_inf.zon");
63 _ = f;
64}
65
66export fn testUntaggedUnion() void {
67 const f: union { foo: void } = @import("zon/neg_inf.zon");
68 _ = f;
69}
70
71export fn testTaggedUnionVoid() void {
72 const f: union(enum) { foo: void } = @import("zon/neg_inf.zon");
73 _ = f;
74}
75
76export fn testVisited() void {
77 const V = struct {
78 ?f32, // Adds `?f32` to the visited list
79 ??f32, // `?f32` is already visited, we need to detect the nested opt anyway
80 f32,
81 };
82 const f: V = @import("zon/neg_inf.zon");
83 _ = f;
84}
85
86export fn testMutablePointer() void {
87 const f: *i32 = @import("zon/neg_inf.zon");
88 _ = f;
89}
90
91// error
92// imports=zon/neg_inf.zon
93//
94// tmp.zig:2:29: error: type 'void' is not available in ZON
95// tmp.zig:7:50: error: type '[*]const u8' is not available in ZON
96// tmp.zig:7:50: note: ZON does not allow many-pointers
97// tmp.zig:12:46: error: type 'error{foo}' is not available in ZON
98// tmp.zig:17:65: error: type '[*c]const u8' is not available in ZON
99// tmp.zig:17:65: note: ZON does not allow C pointers
100// tmp.zig:22:49: error: type '[*c]const u8' is not available in ZON
101// tmp.zig:22:49: note: ZON does not allow C pointers
102// tmp.zig:27:45: error: type '[*c]const u8' is not available in ZON
103// tmp.zig:27:45: note: ZON does not allow C pointers
104// tmp.zig:32:61: error: type '??u8' is not available in ZON
105// tmp.zig:32:61: note: ZON does not allow nested optionals
106// tmp.zig:42:29: error: type '??u8' is not available in ZON
107// tmp.zig:42:29: note: ZON does not allow nested optionals
108// tmp.zig:47:36: error: type '?*const ?u8' is not available in ZON
109// tmp.zig:47:36: note: ZON does not allow nested optionals
110// tmp.zig:52:50: error: type '?*const ?*const u8' is not available in ZON
111// tmp.zig:52:50: note: ZON does not allow nested optionals
112// tmp.zig:82:26: error: type '??f32' is not available in ZON
113// tmp.zig:82:26: note: ZON does not allow nested optionals
114// tmp.zig:87:29: error: type '*i32' is not available in ZON
115// tmp.zig:87:29: note: ZON does not allow mutable pointers
116// neg_inf.zon:1:1: error: expected type '@Type(.enum_literal)'
117// tmp.zig:37:38: note: imported here
118// neg_inf.zon:1:1: error: expected type '?u8'
119// tmp.zig:57:28: note: imported here
120// neg_inf.zon:1:1: error: expected type 'tmp.testNonExhaustiveEnum__enum_525'
121// tmp.zig:62:39: note: imported here
122// neg_inf.zon:1:1: error: expected type 'tmp.testUntaggedUnion__union_527'
123// tmp.zig:67:44: note: imported here
124// neg_inf.zon:1:1: error: expected type 'tmp.testTaggedUnionVoid__union_530'
125// tmp.zig:72:50: note: imported here
test/cases/compile_errors/anytype_param_requires_comptime.zig deleted-20
......@@ -1,20 +0,0 @@
1const S = struct {
2 fn foo(b: u32, c: anytype) void {
3 const C = struct {
4 c: @TypeOf(c),
5 b: u32,
6 };
7 bar(C{ .c = c, .b = b });
8 }
9 fn bar(_: anytype) void {}
10};
11pub export fn entry() void {
12 S.foo(0, u32);
13}
14
15// error
16//
17// :7:25: error: unable to resolve comptime value
18// :7:25: note: initializer of comptime-only struct 'tmp.S.foo__anon_499.C' must be comptime-known
19// :4:16: note: struct requires comptime because of this field
20// :4:16: note: types are not available at runtime
test/cases/compile_errors/bogus_method_call_on_slice.zig deleted-20
......@@ -1,20 +0,0 @@
1var self = "aoeu";
2fn f(m: []const u8) void {
3 m.copy(u8, self[0..], m);
4}
5export fn entry() usize {
6 return @sizeOf(@TypeOf(&f));
7}
8pub export fn entry1() void {
9 .{}.bar();
10}
11pub export fn entry2() void {
12 .{ .foo = 1 }.bar();
13}
14
15// error
16//
17// :3:6: error: no field or member function named 'copy' in '[]const u8'
18// :9:8: error: no field or member function named 'bar' in '@TypeOf(.{})'
19// :12:18: error: no field or member function named 'bar' in 'tmp.entry2__struct_503'
20// :12:6: note: struct declared here
test/cases/compile_errors/coerce_anon_struct.zig deleted-11
......@@ -1,11 +0,0 @@
1const T = struct { x: u32 };
2export fn foo() void {
3 const a = .{ .x = 123 };
4 _ = @as(T, a);
5}
6
7// error
8//
9// :4:16: error: expected type 'tmp.T', found 'tmp.foo__struct_492'
10// :3:16: note: struct declared here
11// :1:11: note: struct declared here
test/cases/compile_errors/redundant_try.zig deleted-52
......@@ -1,52 +0,0 @@
1const S = struct { x: u32 = 0 };
2const T = struct { []const u8 };
3
4fn test0() !void {
5 const x: u8 = try 1;
6 _ = x;
7}
8
9fn test1() !void {
10 const x: S = try .{};
11 _ = x;
12}
13
14fn test2() !void {
15 const x: S = try .{ .x = 123 };
16 _ = x;
17}
18
19fn test3() !void {
20 const x: S = try try .{ .x = 123 };
21 _ = x;
22}
23
24fn test4() !void {
25 const x: T = try .{"hello"};
26 _ = x;
27}
28
29fn test5() !void {
30 const x: error{Foo}!u32 = 123;
31 _ = try try x;
32}
33
34comptime {
35 _ = &test0;
36 _ = &test1;
37 _ = &test2;
38 _ = &test3;
39 _ = &test4;
40 _ = &test5;
41}
42
43// error
44//
45// :5:23: error: expected error union type, found 'comptime_int'
46// :10:23: error: expected error union type, found '@TypeOf(.{})'
47// :15:23: error: expected error union type, found 'tmp.test2__struct_529'
48// :15:23: note: struct declared here
49// :20:27: error: expected error union type, found 'tmp.test3__struct_531'
50// :20:27: note: struct declared here
51// :25:23: error: expected error union type, found 'struct { comptime *const [5:0]u8 = "hello" }'
52// :31:13: error: expected error union type, found 'u32'