aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-15 19:19:28 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-15 19:19:28 -0500
commita05e224150a5a4bcad5ab1b399b43db8a0e28104 (patch)
treedb8352ab2ca029b95050c78364adc4ac0deb1240 /test/compile_errors.zig
parent7293e012d7956b892380517e914108ffadc6941b (diff)
downloadzig-a05e224150a5a4bcad5ab1b399b43db8a0e28104.tar.gz
zig-a05e224150a5a4bcad5ab1b399b43db8a0e28104.zip
typecheck the panic function
this adds the prototype of panic to @import("builtin") and then uses it to do an implicit cast of the panic function to this prototype, rather than redoing all the implicit cast logic. closes #1894 closes #1895
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig14
1 files changed, 12 insertions, 2 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index e7108cb36a..9ef4af4162 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -346,13 +346,23 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
);
cases.add(
- "Panic declared with wrong type signature in tests",
+ "wrong panic signature, runtime function",
\\test "" {}
\\
\\pub fn panic() void {}
\\
,
- ".tmp_source.zig:3:5: error: expected 'fn([]const u8, ?*builtin.StackTrace) noreturn', found 'fn() void'",
+ ".tmp_source.zig:3:5: error: expected type 'fn([]const u8, ?*StackTrace) noreturn', found 'fn() void'",
+ );
+
+ cases.add(
+ "wrong panic signature, generic function",
+ \\pub fn panic(comptime msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn {
+ \\ while (true) {}
+ \\}
+ ,
+ ".tmp_source.zig:1:5: error: expected type 'fn([]const u8, ?*StackTrace) noreturn', found 'fn([]const u8,var)var'",
+ ".tmp_source.zig:1:5: note: only one of the functions is generic",
);
cases.add(