authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-12-30 01:56:48+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-12-31 09:55:04+00:00
log9ff80d7950a720cf80294ceaec54cc33d22f8871
treef0ce20049b120f23316ff5a2b5756c71f30036e1
parent07b936c95fb460c1b71b0b246ba1576167442721
signaturelock-open Commit is signed but in an unrecognized format.

cases: update to new compile error wordings


30 files changed, 90 insertions(+), 105 deletions(-)

test/cases/compile_errors/address_of_threadlocal_not_comptime_known.zig+2-2
...@@ -10,5 +10,5 @@ pub export fn entry() void {...@@ -10,5 +10,5 @@ pub export fn entry() void {
10// target=native10// target=native
11//11//
12// :2:36: error: unable to resolve comptime value12// :2:36: error: unable to resolve comptime value
13// :2:36: note: global variable initializer must be comptime-known13// :2:36: note: initializer of container-level variable must be comptime-known
14// :2:36: note: thread local and dll imported variables have runtime-known addresses14// :2:36: note: threadlocal and dll imported variables have runtime-known addresses
test/cases/compile_errors/anytype_param_requires_comptime.zig+3-3
...@@ -13,8 +13,8 @@ pub export fn entry() void {...@@ -13,8 +13,8 @@ pub export fn entry() void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :7:25: error: unable to resolve comptime value17// :7:25: error: unable to resolve comptime value
20// :7:25: note: initializer of comptime only struct must be comptime-known18// :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
test/cases/compile_errors/array_mult_with_number_type.zig+4-5
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1export fn entry(base: f32, exponent: f32) f32 {1const exponent: f32 = 1.0;
2export fn entry(base: f32) f32 {
2 return base ** exponent;3 return base ** exponent;
3}4}
45
5// error6// error
6// backend=stage2
7// target=native
8//7//
9// :2:12: error: expected indexable; found 'f32'8// :3:12: error: expected indexable; found 'f32'
10// :2:17: note: this operator multiplies arrays; use std.math.pow for exponentiation9// :3:17: note: this operator multiplies arrays; use std.math.pow for exponentiation
test/cases/compile_errors/asm_at_compile_time.zig+2-1
...@@ -15,4 +15,5 @@ fn doSomeAsm() void {...@@ -15,4 +15,5 @@ fn doSomeAsm() void {
15// target=native15// target=native
16//16//
17// :6:5: error: unable to evaluate comptime expression17// :6:5: error: unable to evaluate comptime expression
18// :2:14: note: called from here18// :2:14: note: called at comptime from here
19// :1:1: note: 'comptime' keyword forces comptime evaluation
test/cases/compile_errors/attempted_double_pipe_on_boolean_values.zig+3-5
...@@ -1,13 +1,11 @@...@@ -1,13 +1,11 @@
1export fn entry(a: bool, b: bool) i32 {1export fn entry() i32 {
2 if (a || b) {2 if (true || false) {
3 return 1234;3 return 1234;
4 }4 }
5 return 5678;5 return 5678;
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:9: error: expected error set type, found 'bool'10// :2:9: error: expected error set type, found 'bool'
13// :2:11: note: '||' merges error sets; 'or' performs boolean OR11// :2:14: note: '||' merges error sets; 'or' performs boolean OR
test/cases/compile_errors/branch_in_comptime_only_scope_uses_condbr_inline.zig+2
...@@ -20,4 +20,6 @@ pub export fn entry2() void {...@@ -20,4 +20,6 @@ pub export fn entry2() void {
20//20//
21// :5:15: error: unable to evaluate comptime expression21// :5:15: error: unable to evaluate comptime expression
22// :5:13: note: operation is runtime due to this operand22// :5:13: note: operation is runtime due to this operand
23// :4:72: note: '@shuffle' mask must be comptime-known
23// :13:11: error: unable to evaluate comptime expression24// :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+4-4
...@@ -11,8 +11,8 @@ pub export fn entry2() void {...@@ -11,8 +11,8 @@ pub export fn entry2() void {
11// target=native11// target=native
12//12//
13// :1:16: error: unable to resolve comptime value13// :1:16: error: unable to resolve comptime value
14// :1:16: note: global variable initializer must be comptime-known14// :1:16: note: initializer of container-level variable must be comptime-known
15// :1:16: note: thread local and dll imported variables have runtime-known addresses15// :1:16: note: threadlocal and dll imported variables have runtime-known addresses
16// :2:17: error: unable to resolve comptime value16// :2:17: error: unable to resolve comptime value
17// :2:17: note: global variable initializer must be comptime-known17// :2:17: note: initializer of container-level variable must be comptime-known
18// :2:17: note: thread local and dll imported variables have runtime-known addresses18// :2:17: note: threadlocal and dll imported variables have runtime-known addresses
test/cases/compile_errors/compile_time_struct_field.zig+8-9
...@@ -4,16 +4,15 @@ const S = struct {...@@ -4,16 +4,15 @@ const S = struct {
4};4};
55
6export fn a() void {6export fn a() void {
7 var value: u32 = 3;7 var value: u32 = 3;
8 const comptimeStruct = S {8 const comptimeStruct = S{
9 .normal_ptr = &value,9 .normal_ptr = &value,
10 };10 };
11 _ = comptimeStruct;11 _ = comptimeStruct;
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// 9:6: error: unable to resolve comptime value16// :9:10: error: unable to resolve comptime value
19// 9:6: note: initializer of comptime only struct must be comptime-known17// :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+4-8
...@@ -33,18 +33,14 @@ pub export fn entry2() void {...@@ -33,18 +33,14 @@ pub export fn entry2() void {
33}33}
3434
35// error35// error
36// backend=stage2
37// target=native
38//36//
39// :8:9: error: unable to resolve comptime value37// :8:9: error: unable to resolve comptime value
40// :8:9: note: condition in comptime branch must be comptime-known38// :19:15: note: called at comptime from here
41// :7:13: note: expression is evaluated at comptime because the function returns a comptime-only type 'tmp.S'39// :7:13: note: function with comptime-only return type 'tmp.S' is evaluated at comptime
42// :2:12: note: struct requires comptime because of this field40// :2:12: note: struct requires comptime because of this field
43// :2:12: note: use '*const fn () void' for a function pointer type41// :2:12: note: use '*const fn () void' for a function pointer type
44// :19:15: note: called from here
45// :22:13: error: unable to resolve comptime value42// :22:13: error: unable to resolve comptime value
46// :22:13: note: condition in comptime switch must be comptime-known43// :32:19: note: called at comptime from here
47// :21:17: note: expression is evaluated at comptime because the function returns a comptime-only type 'tmp.S'44// :21:17: note: function with comptime-only return type 'tmp.S' is evaluated at comptime
48// :2:12: note: struct requires comptime because of this field45// :2:12: note: struct requires comptime because of this field
49// :2:12: note: use '*const fn () void' for a function pointer type46// :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+1-1
...@@ -11,4 +11,4 @@ export fn entry() void {...@@ -11,4 +11,4 @@ export fn entry() void {
11// target=native11// target=native
12//12//
13// :6:31: error: unable to resolve comptime value13// :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-known14// :6:31: note: value casted to enum with 'comptime_int' tag type must be comptime-known
test/cases/compile_errors/error_in_typeof_param.zig+1-1
...@@ -11,4 +11,4 @@ pub export fn entry() void {...@@ -11,4 +11,4 @@ pub export fn entry() void {
11// target=native11// target=native
12//12//
13// :6:31: error: unable to resolve comptime value13// :6:31: error: unable to resolve comptime value
14// :6:31: note: value being casted to 'comptime_int' must be comptime-known14// :6:31: note: value casted to 'comptime_int' must be comptime-known
test/cases/compile_errors/explain_why_fn_is_called_at_comptime.zig+2-5
...@@ -4,7 +4,7 @@ const S = struct {...@@ -4,7 +4,7 @@ const S = struct {
4};4};
5fn bar() void {}5fn bar() void {}
66
7fn foo(comptime a: *u8) S {7fn foo(a: *u8) S {
8 return .{ .fnPtr = bar, .a = a.* };8 return .{ .fnPtr = bar, .a = a.* };
9}9}
10pub export fn entry() void {10pub export fn entry() void {
...@@ -13,11 +13,8 @@ pub export fn entry() void {...@@ -13,11 +13,8 @@ pub export fn entry() void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :12:13: error: unable to resolve comptime value17// :12:13: error: unable to resolve comptime value
20// :12:13: note: argument to function being called at comptime must be comptime-known18// :7:16: note: function with comptime-only return type 'tmp.S' is evaluated at comptime
21// :7:25: note: expression is evaluated at comptime because the function returns a comptime-only type 'tmp.S'
22// :2:12: note: struct requires comptime because of this field19// :2:12: note: struct requires comptime because of this field
23// :2:12: note: use '*const fn () void' for a function pointer type20// :2:12: note: use '*const fn () void' for a function pointer type
test/cases/compile_errors/explain_why_generic_fn_is_called_at_comptime.zig+3-4
...@@ -15,9 +15,8 @@ pub export fn entry() void {...@@ -15,9 +15,8 @@ pub export fn entry() void {
15 _ = foo(a, fn () void);15 _ = foo(a, fn () void);
16}16}
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :15:13: error: unable to resolve comptime value19// :15:13: error: unable to resolve comptime value
22// :15:13: note: argument to function being called at comptime must be comptime-known20// :9:38: note: generic function instantiated with comptime-only return type 'tmp.S(fn () void)' is evaluated at comptime
23// :9:38: note: expression is evaluated at comptime because the generic function was instantiated with a comptime-only return type21// :3:16: note: struct requires comptime because of this field
22// :3:16: note: use '*const fn () void' for a function pointer type
test/cases/compile_errors/global_var_struct_init_in_comptim_block.zig deleted-14
...@@ -1,14 +0,0 @@
1const Foo = struct {
2 x: i32,
3};
4var x: Foo = .{ .x = 2 };
5comptime {
6 x = .{ .x = 3 };
7}
8
9// error
10// backend=stage2
11// target=native
12//
13// :6:17: error: unable to evaluate comptime expression
14// :6:17: note: operation is runtime due to this operand
test/cases/compile_errors/global_var_struct_init_in_comptime_block.zig created+15
...@@ -0,0 +1,15 @@
1const Foo = struct {
2 x: i32,
3};
4var x: Foo = .{ .x = 2 };
5comptime {
6 x = .{ .x = 3 };
7}
8
9// error
10// backend=stage2
11// target=native
12//
13// :6:17: error: unable to evaluate comptime expression
14// :6:17: note: operation is runtime due to this operand
15// :5:1: note: 'comptime' keyword forces comptime evaluation
test/cases/compile_errors/global_variable_stored_in_global_const.zig+1-3
...@@ -5,8 +5,6 @@ pub export fn entry() void {...@@ -5,8 +5,6 @@ pub export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:11: error: unable to resolve comptime value9// :2:11: error: unable to resolve comptime value
12// :2:11: note: global variable initializer must be comptime-known10// :2:11: note: initializer of container-level variable must be comptime-known
test/cases/compile_errors/incorrect_pointer_dereference_syntax.zig+1-4
...@@ -1,12 +1,9 @@...@@ -1,12 +1,9 @@
1pub export fn entry() void {1pub export fn entry() void {
2 var a: *u32 = undefined;2 const a: *u32 = undefined;
3 _ = *a;3 _ = *a;
4 _ = &a;
5}4}
65
7// error6// error
8// backend=stage2
9// target=native
10//7//
11// :3:10: error: expected type 'type', found '*u32'8// :3:10: error: expected type 'type', found '*u32'
12// :3:10: note: use '.*' to dereference pointer9// :3:10: note: use '.*' to dereference pointer
test/cases/compile_errors/inline_call_runtime_value_to_comptime_param.zig+1-1
...@@ -14,4 +14,4 @@ pub export fn entry() void {...@@ -14,4 +14,4 @@ pub export fn entry() void {
14// target=native14// target=native
15//15//
16// :5:18: error: unable to resolve comptime value16// :5:18: error: unable to resolve comptime value
17// :5:18: note: parameter is comptime17// :5:18: note: argument to comptime parameter must be comptime-known
test/cases/compile_errors/int-float_conversion_to_comptime_int-float.zig+2-4
...@@ -10,10 +10,8 @@ export fn bar() void {...@@ -10,10 +10,8 @@ export fn bar() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :4:41: error: unable to resolve comptime value14// :4:41: error: unable to resolve comptime value
17// :4:41: note: value being casted to 'comptime_int' must be comptime-known15// :4:41: note: value casted to 'comptime_int' must be comptime-known
18// :9:43: error: unable to resolve comptime value16// :9:43: error: unable to resolve comptime value
19// :9:43: note: value being casted to 'comptime_float' must be comptime-known17// :9:43: note: value casted to 'comptime_float' must be comptime-known
test/cases/compile_errors/non-const_expression_function_call_with_struct_return_value_outside_function.zig+2-3
...@@ -13,9 +13,8 @@ export fn entry() usize {...@@ -13,9 +13,8 @@ export fn entry() usize {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :6:24: error: unable to evaluate comptime expression17// :6:24: error: unable to evaluate comptime expression
20// :6:5: note: operation is runtime due to this operand18// :6:5: note: operation is runtime due to this operand
21// :4:17: note: called from here19// :4:17: note: called at comptime from here
20// :4:17: note: initializer of container-level variable must be comptime-known
test/cases/compile_errors/non-pure_function_returns_type.zig+2-1
...@@ -23,4 +23,5 @@ export fn function_with_return_type_type() void {...@@ -23,4 +23,5 @@ export fn function_with_return_type_type() void {
23//23//
24// :3:7: error: unable to evaluate comptime expression24// :3:7: error: unable to evaluate comptime expression
25// :3:5: note: operation is runtime due to this operand25// :3:5: note: operation is runtime due to this operand
26// :16:19: note: called from here26// :16:19: note: called at comptime from here
27// :16:19: note: types must be comptime-known
test/cases/compile_errors/non_comptime_param_in_comptime_function.zig+1-4
...@@ -9,10 +9,7 @@ export fn entry() void {...@@ -9,10 +9,7 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :8:11: error: unable to resolve comptime value13// :8:11: error: unable to resolve comptime value
16// :8:11: note: argument to function being called at comptime must be comptime-known14// :1:20: note: function with comptime-only return type 'type' is evaluated at comptime
17// :1:20: note: expression is evaluated at comptime because the function returns a comptime-only type 'type'
18// :1:20: note: types are not available at runtime15// :1:20: note: types are not available at runtime
test/cases/compile_errors/non_constant_expression_in_array_size.zig+2-2
...@@ -15,5 +15,5 @@ export fn entry() usize {...@@ -15,5 +15,5 @@ export fn entry() usize {
15// target=native15// target=native
16//16//
17// :6:12: error: unable to resolve comptime value17// :6:12: error: unable to resolve comptime value
18// :6:12: note: value being returned at comptime must be comptime-known18// :2:12: note: called at comptime from here
19// :2:12: note: called from here19// :1:13: note: struct fields must be comptime-known
test/cases/compile_errors/runtime_assignment_to_comptime_struct_type.zig+3-3
...@@ -10,8 +10,8 @@ export fn f() void {...@@ -10,8 +10,8 @@ export fn f() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :7:23: error: unable to resolve comptime value14// :7:23: error: unable to resolve comptime value
17// :7:23: note: initializer of comptime only struct must be comptime-known15// :7:23: note: initializer of comptime-only struct 'tmp.Foo' must be comptime-known
16// :3:10: note: struct requires comptime because of this field
17// :3:10: note: types are not available at runtime
test/cases/compile_errors/runtime_assignment_to_comptime_union_type.zig+3-3
...@@ -10,8 +10,8 @@ export fn f() void {...@@ -10,8 +10,8 @@ export fn f() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :8:23: error: unable to resolve comptime value14// :8:23: error: unable to resolve comptime value
17// :8:23: note: initializer of comptime only union must be comptime-known15// :8:23: note: initializer of comptime-only union 'tmp.Foo' must be comptime-known
16// :3:10: note: union requires comptime because of this field
17// :3:10: note: types are not available at runtime
test/cases/compile_errors/runtime_to_comptime_num.zig+4-4
...@@ -26,10 +26,10 @@ pub export fn entry4() void {...@@ -26,10 +26,10 @@ pub export fn entry4() void {
26// target=native26// target=native
27//27//
28// :4:27: error: unable to resolve comptime value28// :4:27: error: unable to resolve comptime value
29// :4:27: note: value being casted to 'comptime_int' must be comptime-known29// :4:27: note: value casted to 'comptime_int' must be comptime-known
30// :9:29: error: unable to resolve comptime value30// :9:29: error: unable to resolve comptime value
31// :9:29: note: value being casted to 'comptime_float' must be comptime-known31// :9:29: note: value casted to 'comptime_float' must be comptime-known
32// :15:10: error: unable to resolve comptime value32// :15:10: error: unable to resolve comptime value
33// :15:10: note: value being casted to 'comptime_float' must be comptime-known33// :15:10: note: value casted to 'comptime_float' must be comptime-known
34// :21:10: error: unable to resolve comptime value34// :21:10: error: unable to resolve comptime value
35// :21:10: note: value being casted to 'comptime_int' must be comptime-known35// :21:10: note: value casted to 'comptime_int' must be comptime-known
test/cases/compile_errors/slice_of_single-item_pointer_bounds.zig+5-5
...@@ -31,13 +31,13 @@ export fn entry2() void {...@@ -31,13 +31,13 @@ export fn entry2() void {
3131
32// error32// error
33//33//
34// :5:12: error: slice of single-item pointer must have comptime-known bounds [0..0], [0..1], or [1..1]34// :5:12: error: slice of single-item pointer must be bounded
35// :9:13: error: slice of single-item pointer must have comptime-known bounds [0..0], [0..1], or [1..1]35// :9:13: error: slice of single-item pointer must have bounds [0..0], [0..1], or [1..1]
36// :9:13: note: expected '0', found '1'36// :9:13: note: expected '0', found '1'
37// :13:16: error: slice of single-item pointer must have comptime-known bounds [0..0], [0..1], or [1..1]37// :13:16: error: slice of single-item pointer must have bounds [0..0], [0..1], or [1..1]
38// :13:16: note: expected '1', found '2'38// :13:16: note: expected '1', found '2'
39// :17:16: error: end index 2 out of bounds for slice of single-item pointer39// :17:16: error: end index 2 out of bounds for slice of single-item pointer
40// :23:13: error: unable to resolve comptime value40// :23:13: error: unable to resolve comptime value
41// :23:13: note: slice of single-item pointer must have comptime-known bounds [0..0], [0..1], or [1..1]41// :23:13: note: slice of single-item pointer must have comptime-known bounds
42// :29:16: error: unable to resolve comptime value42// :29:16: error: unable to resolve comptime value
43// :29:16: note: slice of single-item pointer must have comptime-known bounds [0..0], [0..1], or [1..1]43// :29:16: note: slice of single-item pointer must have comptime-known bounds
test/cases/compile_errors/unable_to_evaluate_comptime_expr.zig+3-2
...@@ -33,12 +33,13 @@ pub export fn entry3() void {...@@ -33,12 +33,13 @@ pub export fn entry3() void {
33}33}
3434
35// error35// error
36// backend=stage2
37// target=native
38//36//
39// :7:13: error: unable to evaluate comptime expression37// :7:13: error: unable to evaluate comptime expression
40// :7:16: note: operation is runtime due to this operand38// :7:16: note: operation is runtime due to this operand
39// :7:13: note: initializer of container-level variable must be comptime-known
41// :13:13: error: unable to evaluate comptime expression40// :13:13: error: unable to evaluate comptime expression
42// :13:16: note: operation is runtime due to this operand41// :13:16: note: operation is runtime due to this operand
42// :13:13: note: initializer of container-level variable must be comptime-known
43// :22:9: error: unable to evaluate comptime expression43// :22:9: error: unable to evaluate comptime expression
44// :22:21: note: operation is runtime due to this operand44// :22:21: note: operation is runtime due to this operand
45// :21:13: note: enum fields must be comptime-known
test/cases/compile_errors/unable_to_evaluate_expr_inside_cimport.zig+1-1
...@@ -12,4 +12,4 @@ export fn entry() void {...@@ -12,4 +12,4 @@ export fn entry() void {
12//12//
13// :2:11: error: unable to evaluate comptime expression13// :2:11: error: unable to evaluate comptime expression
14// :2:13: note: operation is runtime due to this operand14// :2:13: note: operation is runtime due to this operand
15// :1:11: note: expression is evaluated at comptime because it is inside a @cImport15// :1:11: note: operand to '@cImport' is evaluated at comptime
test/compile_errors.zig+5-3
...@@ -57,8 +57,8 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {...@@ -57,8 +57,8 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {
57 \\}57 \\}
58 , &[_][]const u8{58 , &[_][]const u8{
59 ":3:12: error: unable to resolve comptime value",59 ":3:12: error: unable to resolve comptime value",
60 ":3:12: note: argument to function being called at comptime must be comptime-known",60 ":2:55: note: generic function instantiated with comptime-only return type '?fn () void' is evaluated at comptime",
61 ":2:55: note: expression is evaluated at comptime because the generic function was instantiated with a comptime-only return type",61 ":2:55: note: use '*const fn () void' for a function pointer type",
62 });62 });
63 case.addSourceFile("b.zig",63 case.addSourceFile("b.zig",
64 \\pub const ElfDynLib = struct {64 \\pub const ElfDynLib = struct {
...@@ -198,7 +198,9 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {...@@ -198,7 +198,9 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {
198 ":8:36: error: runtime-known argument passed to comptime parameter",198 ":8:36: error: runtime-known argument passed to comptime parameter",
199 ":2:41: note: declared comptime here",199 ":2:41: note: declared comptime here",
200 ":13:32: error: unable to resolve comptime value",200 ":13:32: error: unable to resolve comptime value",
201 ":13:32: note: initializer of comptime only struct must be comptime-known",201 ":13:32: note: initializer of comptime-only struct 'tmp.callAnytypeFunctionWithRuntimeComptimeOnlyType.S' must be comptime-known",
202 ":12:35: note: struct requires comptime because of this field",
203 ":12:35: note: types are not available at runtime",
202 });204 });
203205
204 case.addSourceFile("import.zig",206 case.addSourceFile("import.zig",