mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
test: migrate stage2 independent compile errors to test manifest parser
This commit is contained in:
parent
3c19f694d9
commit
c8d0fb0b21
@ -42,12 +42,12 @@ test {
|
||||
defer compile_errors_dir.close();
|
||||
|
||||
{
|
||||
var stage2_dir = try compile_errors_dir.openDir("stage2", .{ .iterate = true });
|
||||
defer stage2_dir.close();
|
||||
var dir = try compile_errors_dir.openDir("stage2", .{ .iterate = true });
|
||||
defer dir.close();
|
||||
|
||||
// TODO make this incremental once the bug is solved that it triggers
|
||||
// See: https://github.com/ziglang/zig/issues/11344
|
||||
ctx.addErrorCasesFromDir("stage2", stage2_dir, .stage2, .Obj, false, .independent);
|
||||
ctx.addTestCasesFromDir(dir, .independent);
|
||||
}
|
||||
|
||||
if (!skip_stage1) {
|
||||
|
||||
@ -14,7 +14,7 @@ export fn entry() void {
|
||||
_ = allocator;
|
||||
}
|
||||
|
||||
// constant inside comptime function has compile error
|
||||
// error
|
||||
//
|
||||
// :4:5: error: unreachable code
|
||||
// :4:25: note: control flow is diverted here
|
||||
|
||||
@ -17,7 +17,7 @@ comptime {
|
||||
blk: for(@as([0]void, undefined)) |_| {}
|
||||
}
|
||||
|
||||
// duplicate/unused labels
|
||||
// error
|
||||
//
|
||||
// :2:12: error: redefinition of label 'blk'
|
||||
// :2:5: note: previous definition here
|
||||
|
||||
@ -2,6 +2,6 @@ export fn a() usize {
|
||||
return @embedFile("/root/foo").len;
|
||||
}
|
||||
|
||||
// embed outside package
|
||||
// error
|
||||
//
|
||||
//:2:23: error: embed of file outside package path: '/root/foo'
|
||||
|
||||
@ -2,6 +2,6 @@ export fn a() usize {
|
||||
return @import("../../above.zig").len;
|
||||
}
|
||||
|
||||
// import outside package
|
||||
// error
|
||||
//
|
||||
// :2:20: error: import of file outside package path: '../../above.zig'
|
||||
|
||||
@ -20,7 +20,7 @@ comptime {
|
||||
_ = slice;
|
||||
}
|
||||
|
||||
// out of bounds indexing
|
||||
// error
|
||||
//
|
||||
// :4:26: error: end index 6 out of bounds for slice of length 4 +1 (sentinel)
|
||||
// :9:22: error: end index 6 out of bounds for array of length 4 +1 (sentinel)
|
||||
|
||||
@ -5,6 +5,6 @@ comptime {
|
||||
_ = y;
|
||||
}
|
||||
|
||||
// slice of null C pointer
|
||||
// error
|
||||
//
|
||||
// :4:14: error: slice of null pointer
|
||||
|
||||
@ -8,7 +8,7 @@ export fn entry() void {
|
||||
_ = s;
|
||||
}
|
||||
|
||||
// duplicate struct field name
|
||||
// error
|
||||
//
|
||||
// :3:5: error: duplicate struct field: 'foo'
|
||||
// :2:5: note: other field here
|
||||
|
||||
@ -3,12 +3,12 @@ const U = union {
|
||||
b: u64,
|
||||
};
|
||||
comptime {
|
||||
var u: U = .{.a = {}};
|
||||
var u: U = .{ .a = {} };
|
||||
const v = u.b;
|
||||
_ = v;
|
||||
}
|
||||
|
||||
// access of inactive union field
|
||||
// error
|
||||
//
|
||||
// :7:16: error: access of union field 'b' while field 'a' is active
|
||||
// :1:11: note: union declared here
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const E = enum {a, b};
|
||||
const E = enum { a, b };
|
||||
const U = union(E) {
|
||||
a: u32,
|
||||
a: u32,
|
||||
@ -9,7 +9,7 @@ export fn foo() void {
|
||||
_ = u;
|
||||
}
|
||||
|
||||
// union with enum and duplicate fields
|
||||
// error
|
||||
//
|
||||
// :4:5: error: duplicate union field: 'a'
|
||||
// :3:5: note: other field here
|
||||
|
||||
@ -8,7 +8,7 @@ export fn entry() void {
|
||||
_ = u;
|
||||
}
|
||||
|
||||
// duplicate union field name
|
||||
// error
|
||||
//
|
||||
// :3:5: error: duplicate union field: 'foo'
|
||||
// :2:5: note: other field here
|
||||
|
||||
@ -13,7 +13,7 @@ export fn entry() usize {
|
||||
return @sizeOf(U);
|
||||
}
|
||||
|
||||
// enum field missing in union
|
||||
// error
|
||||
//
|
||||
// :7:1: error: enum field(s) missing in union
|
||||
// :4:5: note: field 'c' missing, declared here
|
||||
|
||||
@ -13,7 +13,7 @@ export fn entry() usize {
|
||||
return @sizeOf(U);
|
||||
}
|
||||
|
||||
// union extra field
|
||||
// error
|
||||
//
|
||||
// :6:1: error: enum 'tmp.E' has no field named 'd'
|
||||
// :1:11: note: enum declared here
|
||||
|
||||
@ -14,7 +14,7 @@ export fn doTheTest() u64 {
|
||||
return u.b;
|
||||
}
|
||||
|
||||
// runtime coercion from enum to union
|
||||
// error
|
||||
//
|
||||
// :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields
|
||||
// :6:5: note: field 'a' has type 'u32'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user