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 {
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+3-3
......@@ -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
test/cases/compile_errors/array_mult_with_number_type.zig+4-5
......@@ -1,10 +1,9 @@
1export fn entry(base: f32, exponent: f32) f32 {
1const exponent: f32 = 1.0;
2export 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+2-1
......@@ -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
test/cases/compile_errors/attempted_double_pipe_on_boolean_values.zig+3-5
......@@ -1,13 +1,11 @@
1export fn entry(a: bool, b: bool) i32 {
2 if (a || b) {
1export 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+2
......@@ -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+4-4
......@@ -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+8-9
......@@ -4,16 +4,15 @@ const S = struct {
44};
55
66export 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+4-8
......@@ -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+1-1
......@@ -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
test/cases/compile_errors/error_in_typeof_param.zig+1-1
......@@ -11,4 +11,4 @@ pub 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 'comptime_int' must be comptime-known
14// :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 {
44};
55fn bar() void {}
66
7fn foo(comptime a: *u8) S {
7fn foo(a: *u8) S {
88 return .{ .fnPtr = bar, .a = a.* };
99}
1010pub export fn entry() void {
......@@ -13,11 +13,8 @@ pub export fn entry() void {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :12:13: error: unable to resolve comptime value
20// :12:13: note: argument to function being called at comptime must be comptime-known
21// :7:25: note: expression is evaluated at comptime because the function returns a comptime-only type 'tmp.S'
18// :7:16: note: function with comptime-only return type 'tmp.S' is evaluated at comptime
2219// :2:12: note: struct requires comptime because of this field
2320// :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 {
1515 _ = foo(a, fn () void);
1616}
1717// error
18// backend=stage2
19// target=native
2018//
2119// :15:13: error: unable to resolve comptime value
22// :15:13: note: argument to function being called at comptime must be comptime-known
23// :9:38: note: expression is evaluated at comptime because the generic function was instantiated with a comptime-only return type
20// :9:38: note: generic function instantiated with comptime-only return type 'tmp.S(fn () void)' is evaluated at comptime
21// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :2:11: error: unable to resolve comptime value
12// :2:11: note: global variable initializer must be comptime-known
10// :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 @@
11pub export fn entry() void {
2 var a: *u32 = undefined;
2 const a: *u32 = undefined;
33 _ = *a;
4 _ = &a;
54}
65
76// error
8// backend=stage2
9// target=native
107//
118// :3:10: error: expected type 'type', found '*u32'
129// :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 {
1414// target=native
1515//
1616// :5:18: error: unable to resolve comptime value
17// :5:18: note: parameter is comptime
17// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :4:41: error: unable to resolve comptime value
17// :4:41: note: value being casted to 'comptime_int' must be comptime-known
15// :4:41: note: value casted to 'comptime_int' must be comptime-known
1816// :9:43: error: unable to resolve comptime value
19// :9:43: note: value being casted to 'comptime_float' must be comptime-known
17// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :6:24: error: unable to evaluate comptime expression
2018// :6:5: note: operation is runtime due to this operand
21// :4:17: note: called from here
19// :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 {
2323//
2424// :3:7: error: unable to evaluate comptime expression
2525// :3:5: note: operation is runtime due to this operand
26// :16:19: note: called from here
26// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :8:11: error: unable to resolve comptime value
16// :8:11: note: argument to function being called at comptime must be comptime-known
17// :1:20: note: expression is evaluated at comptime because the function returns a comptime-only type 'type'
14// :1:20: note: function with comptime-only return type 'type' is evaluated at comptime
1815// :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 {
1515// target=native
1616//
1717// :6:12: error: unable to resolve comptime value
18// :6:12: note: value being returned at comptime must be comptime-known
19// :2:12: note: called from here
18// :2:12: note: called at comptime from here
19// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :7:23: error: unable to resolve comptime value
17// :7:23: note: initializer of comptime only struct must be comptime-known
15// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :8:23: error: unable to resolve comptime value
17// :8:23: note: initializer of comptime only union must be comptime-known
15// :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 {
2626// target=native
2727//
2828// :4:27: error: unable to resolve comptime value
29// :4:27: note: value being casted to 'comptime_int' must be comptime-known
29// :4:27: note: value casted to 'comptime_int' must be comptime-known
3030// :9:29: error: unable to resolve comptime value
31// :9:29: note: value being casted to 'comptime_float' must be comptime-known
31// :9:29: note: value casted to 'comptime_float' must be comptime-known
3232// :15:10: error: unable to resolve comptime value
33// :15:10: note: value being casted to 'comptime_float' must be comptime-known
33// :15:10: note: value casted to 'comptime_float' must be comptime-known
3434// :21:10: error: unable to resolve comptime value
35// :21:10: note: value being casted to 'comptime_int' must be comptime-known
35// :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 {
3131
3232// error
3333//
34// :5:12: 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 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 bounds [0..0], [0..1], or [1..1]
3636// :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]
3838// :13:16: note: expected '1', found '2'
3939// :17:16: error: end index 2 out of bounds for slice of single-item pointer
4040// :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
4242// :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 {
3333}
3434
3535// error
36// backend=stage2
37// target=native
3836//
3937// :7:13: error: unable to evaluate comptime expression
4038// :7:16: note: operation is runtime due to this operand
39// :7:13: note: initializer of container-level variable must be comptime-known
4140// :13:13: error: unable to evaluate comptime expression
4241// :13:16: note: operation is runtime due to this operand
42// :13:13: note: initializer of container-level variable must be comptime-known
4343// :22:9: error: unable to evaluate comptime expression
4444// :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 {
1212//
1313// :2:11: error: unable to evaluate comptime expression
1414// :2:13: note: operation is runtime due to this operand
15// :1:11: note: expression is evaluated at comptime because it is inside a @cImport
15// :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 {
5757 \\}
5858 , &[_][]const u8{
5959 ":3:12: error: unable to resolve comptime value",
60 ":3:12: note: argument to function being called at comptime must be comptime-known",
61 ":2:55: note: expression is evaluated at comptime because the generic function was instantiated with a comptime-only return type",
60 ":2:55: note: generic function instantiated with comptime-only return type '?fn () void' is evaluated at comptime",
61 ":2:55: note: use '*const fn () void' for a function pointer type",
6262 });
6363 case.addSourceFile("b.zig",
6464 \\pub const ElfDynLib = struct {
......@@ -198,7 +198,9 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {
198198 ":8:36: error: runtime-known argument passed to comptime parameter",
199199 ":2:41: note: declared comptime here",
200200 ":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",
202204 });
203205
204206 case.addSourceFile("import.zig",