From 52bb71867d8d6e738eefb7dafead875eb21a4ae7 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 22 Feb 2019 13:28:57 -0500 Subject: implement vector negation also fix vector behavior tests, they weren't actually testing runtime vectors, but now they are. See #903 --- test/compile_errors.zig | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/compile_errors.zig') diff --git a/test/compile_errors.zig b/test/compile_errors.zig index c39d34b3e9..48eb7cd85d 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -1,6 +1,18 @@ const tests = @import("tests.zig"); pub fn addCases(cases: *tests.CompileErrorContext) void { + cases.addTest( + "comptime vector overflow shows the index", + \\comptime { + \\ var a: @Vector(4, u8) = []u8{ 1, 2, 255, 4 }; + \\ var b: @Vector(4, u8) = []u8{ 5, 6, 1, 8 }; + \\ var x = a + b; + \\} + , + ".tmp_source.zig:4:15: error: operation caused overflow", + ".tmp_source.zig:4:15: note: when computing vector element at index 2", + ); + cases.addTest( "packed struct with fields of not allowed types", \\const A = packed struct { -- cgit v1.2.3