diff --git a/tests/sema/error_messages/errors.zig b/tests/sema/error_messages/errors.zig new file mode 100644 index 000000000..6d46155d2 --- /dev/null +++ b/tests/sema/error_messages/errors.zig @@ -0,0 +1,2 @@ +const ErrorUnion = type!void; +// ^^^^ error: expected error set type, found 'type' diff --git a/tests/sema/error_messages/optionals.zig b/tests/sema/error_messages/optionals.zig index ae3a7b2d0..4663e1000 100644 --- a/tests/sema/error_messages/optionals.zig +++ b/tests/sema/error_messages/optionals.zig @@ -1,9 +1,13 @@ const some_value: ?u32 = 5; const no_value: ?u32 = null; const undefined_value: ?u32 = undefined; +const not_opt_value: u32 = 0; const null_unwrap = no_value.?; // ^^^^^^^^^^ error: tried to unwrap optional of type `u32` which was null const undefined_unwrap = undefined_value.?; // ^^^^^^^^^^^^^^^^^ error: tried to unwrap optional of type `u32` which was undefined + +const invalid_unwrap = not_opt_value.?; +// ^^^^^^^^^^^^^^^ error: expected optional type, found 'u32'