diff options
Diffstat (limited to 'test/cases')
15 files changed, 31 insertions, 14 deletions
diff --git a/test/cases/aarch64-macos/hello_world_with_updates.1.zig b/test/cases/aarch64-macos/hello_world_with_updates.1.zig index 435747c2ee..e18a4c6a1e 100644 --- a/test/cases/aarch64-macos/hello_world_with_updates.1.zig +++ b/test/cases/aarch64-macos/hello_world_with_updates.1.zig @@ -2,4 +2,5 @@ pub export fn main() noreturn {} // error // -// :1:32: error: expected type 'noreturn', found 'void' +// :1:32: error: function declared 'noreturn' returns +// :1:22: note: 'noreturn' declared here diff --git a/test/cases/compile_errors/address_of_number_literal.zig b/test/cases/compile_errors/address_of_number_literal.zig index 2000561207..c6b41a1495 100644 --- a/test/cases/compile_errors/address_of_number_literal.zig +++ b/test/cases/compile_errors/address_of_number_literal.zig @@ -9,3 +9,4 @@ export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } // // :3:30: error: expected type '*const i32', found '*const comptime_int' // :3:30: note: pointer type child 'comptime_int' cannot cast into pointer type child 'i32' +// :3:10: note: function return type declared here diff --git a/test/cases/compile_errors/incompatible_sentinels.zig b/test/cases/compile_errors/incompatible_sentinels.zig index a2ed320e18..821a0a8c69 100644 --- a/test/cases/compile_errors/incompatible_sentinels.zig +++ b/test/cases/compile_errors/incompatible_sentinels.zig @@ -21,8 +21,10 @@ export fn entry4() void { // // :4:12: error: expected type '[*:0]u8', found '[*:255]u8' // :4:12: note: pointer sentinel '255' cannot cast into pointer sentinel '0' +// :3:35: note: function return type declared here // :7:12: error: expected type '[*:0]u8', found '[*]u8' // :7:12: note: destination pointer requires '0' sentinel +// :6:31: note: function return type declared here // :10:35: error: expected type '[2:0]u8', found '[2:255]u8' // :10:35: note: array sentinel '255' cannot cast into array sentinel '0' // :14:31: error: expected type '[2:0]u8', found '[2]u8' diff --git a/test/cases/compile_errors/incorrect_return_type.zig b/test/cases/compile_errors/incorrect_return_type.zig index 7b678b68e3..57cf54a023 100644 --- a/test/cases/compile_errors/incorrect_return_type.zig +++ b/test/cases/compile_errors/incorrect_return_type.zig @@ -21,3 +21,4 @@ // :8:16: error: expected type 'tmp.A', found 'tmp.B' // :10:12: note: struct declared here // :4:12: note: struct declared here +// :7:11: note: function return type declared here diff --git a/test/cases/compile_errors/invalid_address_space_coercion.zig b/test/cases/compile_errors/invalid_address_space_coercion.zig index 1c42260a0e..4633b12e0f 100644 --- a/test/cases/compile_errors/invalid_address_space_coercion.zig +++ b/test/cases/compile_errors/invalid_address_space_coercion.zig @@ -12,3 +12,4 @@ pub fn main() void { // // :2:12: error: expected type '*i32', found '*addrspace(.gs) i32' // :2:12: note: address space 'gs' cannot cast into address space 'generic' +// :1:34: note: function return type declared here diff --git a/test/cases/compile_errors/invalid_pointer_keeps_address_space_when_taking_address_of_dereference.zig b/test/cases/compile_errors/invalid_pointer_keeps_address_space_when_taking_address_of_dereference.zig index fb8e0d5fd4..4d7b3c627b 100644 --- a/test/cases/compile_errors/invalid_pointer_keeps_address_space_when_taking_address_of_dereference.zig +++ b/test/cases/compile_errors/invalid_pointer_keeps_address_space_when_taking_address_of_dereference.zig @@ -12,3 +12,4 @@ pub fn main() void { // // :2:12: error: expected type '*i32', found '*addrspace(.gs) i32' // :2:12: note: address space 'gs' cannot cast into address space 'generic' +// :1:34: note: function return type declared here diff --git a/test/cases/compile_errors/pointer_with_different_address_spaces.zig b/test/cases/compile_errors/pointer_with_different_address_spaces.zig index 3f8c961174..2bbea3d3b6 100644 --- a/test/cases/compile_errors/pointer_with_different_address_spaces.zig +++ b/test/cases/compile_errors/pointer_with_different_address_spaces.zig @@ -12,3 +12,4 @@ export fn entry2() void { // // :2:12: error: expected type '*addrspace(.fs) i32', found '*addrspace(.gs) i32' // :2:12: note: address space 'gs' cannot cast into address space 'fs' +// :1:34: note: function return type declared here diff --git a/test/cases/compile_errors/pointers_with_different_address_spaces.zig b/test/cases/compile_errors/pointers_with_different_address_spaces.zig index 2a7698d0d9..e952da2af5 100644 --- a/test/cases/compile_errors/pointers_with_different_address_spaces.zig +++ b/test/cases/compile_errors/pointers_with_different_address_spaces.zig @@ -12,3 +12,4 @@ pub fn main() void { // // :2:13: error: expected type '*i32', found '*addrspace(.gs) i32' // :2:13: note: address space 'gs' cannot cast into address space 'generic' +// :1:35: note: function return type declared here diff --git a/test/cases/compile_errors/slice_sentinel_mismatch-2.zig b/test/cases/compile_errors/slice_sentinel_mismatch-2.zig index b1ff905e26..3cc5ac4c39 100644 --- a/test/cases/compile_errors/slice_sentinel_mismatch-2.zig +++ b/test/cases/compile_errors/slice_sentinel_mismatch-2.zig @@ -10,3 +10,4 @@ comptime { _ = foo; } // // :3:12: error: expected type '[:0]u8', found '[]u8' // :3:12: note: destination pointer requires '0' sentinel +// :1:10: note: function return type declared here diff --git a/test/cases/compile_errors/stage1/test/helpful_return_type_error_message.zig b/test/cases/compile_errors/stage1/test/helpful_return_type_error_message.zig index 0e97c09de2..b8e48036de 100644 --- a/test/cases/compile_errors/stage1/test/helpful_return_type_error_message.zig +++ b/test/cases/compile_errors/stage1/test/helpful_return_type_error_message.zig @@ -16,15 +16,17 @@ export fn quux() u32 { } // error -// backend=stage1 +// backend=stage2 // target=native -// is_test=1 // -// tmp.zig:2:17: error: expected type 'u32', found 'error{Ohno}' -// tmp.zig:1:17: note: function cannot return an error -// tmp.zig:8:5: error: expected type 'void', found '@typeInfo(@typeInfo(@TypeOf(bar)).Fn.return_type.?).ErrorUnion.error_set' -// tmp.zig:7:17: note: function cannot return an error -// tmp.zig:11:15: error: cannot convert error union to payload type. consider using `try`, `catch`, or `if`. expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(bar)).Fn.return_type.?).ErrorUnion.error_set!u32' -// tmp.zig:10:17: note: function cannot return an error -// tmp.zig:15:14: error: cannot convert error union to payload type. consider using `try`, `catch`, or `if`. expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(bar)).Fn.return_type.?).ErrorUnion.error_set!u32' -// tmp.zig:14:5: note: cannot store an error in type 'u32' +// :2:18: error: expected type 'u32', found 'error{Ohno}' +// :1:17: note: function cannot return an error +// :8:5: error: expected type 'void', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).Fn.return_type.?).ErrorUnion.error_set' +// :7:17: note: function cannot return an error +// :11:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).Fn.return_type.?).ErrorUnion.error_set!u32' +// :10:17: note: function cannot return an error +// :11:15: note: cannot convert error union to payload type +// :11:15: note: consider using `try`, `catch`, or `if` +// :15:14: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).Fn.return_type.?).ErrorUnion.error_set!u32' +// :15:14: note: cannot convert error union to payload type +// :15:14: note: consider using `try`, `catch`, or `if` diff --git a/test/cases/compile_errors/try_in_function_with_non_error_return_type.zig b/test/cases/compile_errors/try_in_function_with_non_error_return_type.zig index 2107c2a397..44d8b9ee56 100644 --- a/test/cases/compile_errors/try_in_function_with_non_error_return_type.zig +++ b/test/cases/compile_errors/try_in_function_with_non_error_return_type.zig @@ -8,3 +8,4 @@ fn something() anyerror!void { } // target=native // // :2:5: error: expected type 'void', found 'anyerror' +// :1:15: note: function cannot return an error diff --git a/test/cases/compile_errors/unreachable_with_return.zig b/test/cases/compile_errors/unreachable_with_return.zig index cc6439ca0f..5293734c82 100644 --- a/test/cases/compile_errors/unreachable_with_return.zig +++ b/test/cases/compile_errors/unreachable_with_return.zig @@ -5,4 +5,5 @@ export fn entry() void { a(); } // backend=stage2 // target=native // -// :1:18: error: expected type 'noreturn', found 'void' +// :1:18: error: function declared 'noreturn' returns +// :1:8: note: 'noreturn' declared here diff --git a/test/cases/compile_errors/variable_has_wrong_type.zig b/test/cases/compile_errors/variable_has_wrong_type.zig index ec21c610e0..e99921db9f 100644 --- a/test/cases/compile_errors/variable_has_wrong_type.zig +++ b/test/cases/compile_errors/variable_has_wrong_type.zig @@ -8,3 +8,4 @@ export fn f() i32 { // target=native // // :3:12: error: expected type 'i32', found '*const [1:0]u8' +// :1:15: note: function return type declared here diff --git a/test/cases/x86_64-linux/hello_world_with_updates.1.zig b/test/cases/x86_64-linux/hello_world_with_updates.1.zig index 9be388ab63..1f1a6a9682 100644 --- a/test/cases/x86_64-linux/hello_world_with_updates.1.zig +++ b/test/cases/x86_64-linux/hello_world_with_updates.1.zig @@ -2,4 +2,5 @@ pub export fn _start() noreturn {} // error // -// :1:34: error: expected type 'noreturn', found 'void' +// :1:34: error: function declared 'noreturn' returns +// :1:24: note: 'noreturn' declared here diff --git a/test/cases/x86_64-macos/hello_world_with_updates.1.zig b/test/cases/x86_64-macos/hello_world_with_updates.1.zig index 435747c2ee..e18a4c6a1e 100644 --- a/test/cases/x86_64-macos/hello_world_with_updates.1.zig +++ b/test/cases/x86_64-macos/hello_world_with_updates.1.zig @@ -2,4 +2,5 @@ pub export fn main() noreturn {} // error // -// :1:32: error: expected type 'noreturn', found 'void' +// :1:32: error: function declared 'noreturn' returns +// :1:22: note: 'noreturn' declared here |
