mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
test: add new incremental test
This case is adapted from #11344, and passes with `-fno-emit-bin`. Resolves: #11344
This commit is contained in:
parent
3fb5cad07d
commit
1ccbc6ca20
1 changed files with 38 additions and 0 deletions
38
test/incremental/delete_comptime_decls
Normal file
38
test/incremental/delete_comptime_decls
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#target=x86_64-linux
|
||||
#update=initial version
|
||||
#file=main.zig
|
||||
pub fn main() void {}
|
||||
comptime {
|
||||
var array = [_:0]u8{ 1, 2, 3, 4 };
|
||||
const src_slice: [:0]u8 = &array;
|
||||
const slice = src_slice[2..6];
|
||||
_ = slice;
|
||||
}
|
||||
comptime {
|
||||
var array = [_:0]u8{ 1, 2, 3, 4 };
|
||||
const slice = array[2..6];
|
||||
_ = slice;
|
||||
}
|
||||
comptime {
|
||||
var array = [_]u8{ 1, 2, 3, 4 };
|
||||
const slice = array[2..5];
|
||||
_ = slice;
|
||||
}
|
||||
comptime {
|
||||
var array = [_:0]u8{ 1, 2, 3, 4 };
|
||||
const slice = array[3..2];
|
||||
_ = slice;
|
||||
}
|
||||
#expect_error=ignored
|
||||
|
||||
#update=delete and modify comptime decls
|
||||
#file=main.zig
|
||||
pub fn main() void {}
|
||||
comptime {
|
||||
const x: [*c]u8 = null;
|
||||
var runtime_len: usize = undefined;
|
||||
runtime_len = 0;
|
||||
const y = x[0..runtime_len];
|
||||
_ = y;
|
||||
}
|
||||
#expect_error=ignored
|
||||
Loading…
Add table
Reference in a new issue