diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-11-04 16:19:43 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-11-04 16:20:02 -0400 |
| commit | f0d755153d90f35da612c8aa6f1853f5112f5cf1 (patch) | |
| tree | d27f43804e4805b78c75443cdd4ec706d37c87d8 /test/compile_errors.zig | |
| parent | 4a6df04f7568dd84245b513bfd8d245f31fa8f04 (diff) | |
| download | zig-f0d755153d90f35da612c8aa6f1853f5112f5cf1.tar.gz zig-f0d755153d90f35da612c8aa6f1853f5112f5cf1.zip | |
add compile-time reflection for function arg types
See #383
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index f8e08d599f..6901bd302c 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2275,4 +2275,18 @@ pub fn addCases(cases: &tests.CompileErrorContext) { , ".tmp_source.zig:2:1: error: invalid character: '\\t'"); + cases.add("@ArgType given non function parameter", + \\comptime { + \\ _ = @ArgType(i32, 3); + \\} + , + ".tmp_source.zig:2:18: error: expected function, found 'i32'"); + + cases.add("@ArgType arg index out of bounds", + \\comptime { + \\ _ = @ArgType(@typeOf(add), 2); + \\} + \\fn add(a: i32, b: i32) -> i32 { return a + b; } + , + ".tmp_source.zig:2:32: error: arg index 2 out of bounds; 'fn(i32, i32) -> i32' has 2 arguments"); } |
