Skip to content

Commit 9ff80d7

Browse files
committed
cases: update to new compile error wordings
1 parent 07b936c commit 9ff80d7

29 files changed

+76
-91
lines changed

test/cases/compile_errors/address_of_threadlocal_not_comptime_known.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ pub export fn entry() void {
1010
// target=native
1111
//
1212
// :2:36: error: unable to resolve comptime value
13-
// :2:36: note: global variable initializer must be comptime-known
14-
// :2:36: note: thread local and dll imported variables have runtime-known addresses
13+
// :2:36: note: initializer of container-level variable must be comptime-known
14+
// :2:36: note: threadlocal and dll imported variables have runtime-known addresses

test/cases/compile_errors/anytype_param_requires_comptime.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ pub export fn entry() void {
1313
}
1414

1515
// error
16-
// backend=stage2
17-
// target=native
1816
//
1917
// :7:25: error: unable to resolve comptime value
20-
// :7:25: note: initializer of comptime only struct must be comptime-known
18+
// :7:25: note: initializer of comptime-only struct 'tmp.S.foo__anon_166.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
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
export fn entry(base: f32, exponent: f32) f32 {
1+
const exponent: f32 = 1.0;
2+
export fn entry(base: f32) f32 {
23
return base ** exponent;
34
}
45

56
// error
6-
// backend=stage2
7-
// target=native
87
//
9-
// :2:12: error: expected indexable; found 'f32'
10-
// :2:17: note: this operator multiplies arrays; use std.math.pow for exponentiation
8+
// :3:12: error: expected indexable; found 'f32'
9+
// :3:17: note: this operator multiplies arrays; use std.math.pow for exponentiation

test/cases/compile_errors/asm_at_compile_time.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ fn doSomeAsm() void {
1515
// target=native
1616
//
1717
// :6:5: error: unable to evaluate comptime expression
18-
// :2:14: note: called from here
18+
// :2:14: note: called at comptime from here
19+
// :1:1: note: 'comptime' keyword forces comptime evaluation
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
export fn entry(a: bool, b: bool) i32 {
2-
if (a || b) {
1+
export fn entry() i32 {
2+
if (true || false) {
33
return 1234;
44
}
55
return 5678;
66
}
77

88
// error
9-
// backend=stage2
10-
// target=native
119
//
1210
// :2:9: error: expected error set type, found 'bool'
13-
// :2:11: note: '||' merges error sets; 'or' performs boolean OR
11+
// :2:14: note: '||' merges error sets; 'or' performs boolean OR

test/cases/compile_errors/branch_in_comptime_only_scope_uses_condbr_inline.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ pub export fn entry2() void {
2020
//
2121
// :5:15: error: unable to evaluate comptime expression
2222
// :5:13: note: operation is runtime due to this operand
23+
// :4:72: note: '@shuffle' mask must be comptime-known
2324
// :13:11: error: unable to evaluate comptime expression
25+
// :12:72: note: '@shuffle' mask must be comptime-known

test/cases/compile_errors/builtin_extern_in_comptime_scope.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ pub export fn entry2() void {
1111
// target=native
1212
//
1313
// :1:16: error: unable to resolve comptime value
14-
// :1:16: note: global variable initializer must be comptime-known
15-
// :1:16: note: thread local and dll imported variables have runtime-known addresses
14+
// :1:16: note: initializer of container-level variable must be comptime-known
15+
// :1:16: note: threadlocal and dll imported variables have runtime-known addresses
1616
// :2:17: error: unable to resolve comptime value
17-
// :2:17: note: global variable initializer must be comptime-known
18-
// :2:17: note: thread local and dll imported variables have runtime-known addresses
17+
// :2:17: note: initializer of container-level variable must be comptime-known
18+
// :2:17: note: threadlocal and dll imported variables have runtime-known addresses

test/cases/compile_errors/compile_time_struct_field.zig

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ const S = struct {
44
};
55

66
export fn a() void {
7-
var value: u32 = 3;
8-
const comptimeStruct = S {
9-
.normal_ptr = &value,
10-
};
11-
_ = comptimeStruct;
7+
var value: u32 = 3;
8+
const comptimeStruct = S{
9+
.normal_ptr = &value,
10+
};
11+
_ = comptimeStruct;
1212
}
1313

1414
// error
15-
// backend=stage2
16-
// target=native
1715
//
18-
// 9:6: error: unable to resolve comptime value
19-
// 9:6: note: initializer of comptime only struct must be comptime-known
16+
// :9:10: error: unable to resolve comptime value
17+
// :9:10: note: initializer of comptime-only struct 'tmp.S' must be comptime-known
18+
// :2:21: note: struct requires comptime because of this field

test/cases/compile_errors/condition_comptime_reason_explained.zig

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,14 @@ pub export fn entry2() void {
3333
}
3434

3535
// error
36-
// backend=stage2
37-
// target=native
3836
//
3937
// :8:9: error: unable to resolve comptime value
40-
// :8:9: note: condition in comptime branch must be comptime-known
41-
// :7:13: note: expression is evaluated at comptime because the function returns a comptime-only type 'tmp.S'
38+
// :19:15: note: called at comptime from here
39+
// :7:13: note: function with comptime-only return type 'tmp.S' is evaluated at comptime
4240
// :2:12: note: struct requires comptime because of this field
4341
// :2:12: note: use '*const fn () void' for a function pointer type
44-
// :19:15: note: called from here
4542
// :22:13: error: unable to resolve comptime value
46-
// :22:13: note: condition in comptime switch must be comptime-known
47-
// :21:17: note: expression is evaluated at comptime because the function returns a comptime-only type 'tmp.S'
43+
// :32:19: note: called at comptime from here
44+
// :21:17: note: function with comptime-only return type 'tmp.S' is evaluated at comptime
4845
// :2:12: note: struct requires comptime because of this field
4946
// :2:12: note: use '*const fn () void' for a function pointer type
50-
// :32:19: note: called from here

test/cases/compile_errors/enum_backed_by_comptime_int_must_be_casted_from_comptime_value.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ export fn entry() void {
1111
// target=native
1212
//
1313
// :6:31: error: unable to resolve comptime value
14-
// :6:31: note: value being casted to enum with 'comptime_int' tag type must be comptime-known
14+
// :6:31: note: value casted to enum with 'comptime_int' tag type must be comptime-known

0 commit comments

Comments
 (0)