test: update cases to silence 'var is never mutated' errors

This commit is contained in:
mlugg
2023-11-11 07:27:31 +00:00
parent 2c1acb6180
commit 21fa187abc
289 changed files with 671 additions and 489 deletions

View File

@@ -1,49 +1,54 @@
pub export fn entry1() void {
const T = @TypeOf(.{ 123, 3 });
var b = T{ .@"1" = 3 };
_ = b;
_ = &b;
var c = T{ 123, 3 };
_ = c;
_ = &c;
var d = T{};
_ = d;
_ = &d;
}
pub export fn entry2() void {
var a: u32 = 2;
_ = &a;
const T = @TypeOf(.{ 123, a });
var b = T{ .@"1" = 3 };
_ = b;
_ = &b;
var c = T{ 123, 3 };
_ = c;
_ = &c;
var d = T{};
_ = d;
_ = &d;
}
pub export fn entry3() void {
var a: u32 = 2;
_ = &a;
const T = @TypeOf(.{ 123, a });
var b = T{ .@"0" = 123 };
_ = b;
_ = &b;
}
comptime {
var a: u32 = 2;
_ = &a;
const T = @TypeOf(.{ 123, a });
var b = T{ .@"0" = 123 };
_ = b;
_ = &b;
var c = T{ 123, 2 };
_ = c;
_ = &c;
var d = T{};
_ = d;
_ = &d;
}
pub export fn entry4() void {
var a: u32 = 2;
_ = &a;
const T = @TypeOf(.{ 123, a });
var b = T{ 123, 4, 5 };
_ = b;
_ = &b;
}
pub export fn entry5() void {
var a: u32 = 2;
_ = &a;
const T = @TypeOf(.{ 123, a });
var b = T{ .@"0" = 123, .@"2" = 123, .@"1" = 123 };
_ = b;
_ = &b;
}
pub const Consideration = struct {
curve: Curve,
@@ -64,9 +69,9 @@ pub export fn entry6() void {
// backend=stage2
// target=native
//
// :17:14: error: missing tuple field with index 1
// :23:14: error: missing tuple field with index 1
// :39:14: error: expected at most 2 tuple fields; found 3
// :45:30: error: index '2' out of bounds of tuple 'struct{comptime comptime_int = 123, u32}'
// :58:37: error: missing tuple field with index 3
// :53:32: note: struct declared here
// :18:14: error: missing tuple field with index 1
// :25:14: error: missing tuple field with index 1
// :43:14: error: expected at most 2 tuple fields; found 3
// :50:30: error: index '2' out of bounds of tuple 'struct{comptime comptime_int = 123, u32}'
// :63:37: error: missing tuple field with index 3
// :58:32: note: struct declared here