implement vector negation

also fix vector behavior tests, they weren't actually testing
runtime vectors, but now they are.

See #903
This commit is contained in:
Andrew Kelley
2019-02-22 13:28:57 -05:00
parent 2fe8a0831f
commit 52bb71867d
5 changed files with 157 additions and 47 deletions

View File

@@ -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 {