diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-08-27 17:11:43 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-08-27 17:13:34 -0400 |
| commit | 009e90f446ec7a81d602906fda9b17a6af1859f5 (patch) | |
| tree | cebcac299214f9db88acd0015bafe26b7d4be657 /test/compile_errors.zig | |
| parent | 2f2215c9f46f0a75ce65803af84984b4a5f3741c (diff) | |
| download | zig-009e90f446ec7a81d602906fda9b17a6af1859f5.tar.gz zig-009e90f446ec7a81d602906fda9b17a6af1859f5.zip | |
fix @typeInfo unable to distinguish compile error vs no-payload
closes #1421
closes #1426
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 56b2c51d74..d0795c4550 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2,6 +2,23 @@ const tests = @import("tests.zig"); pub fn addCases(cases: *tests.CompileErrorContext) void { cases.add( + "@typeInfo causing depend on itself compile error", + \\const start = struct { + \\ fn crash() bug() { + \\ return bug; + \\ } + \\}; + \\fn bug() void { + \\ _ = @typeInfo(start).Struct; + \\} + \\export fn entry() void { + \\ var boom = start.crash(); + \\} + , + ".tmp_source.zig:2:5: error: 'crash' depends on itself", + ); + + cases.add( "@handle() called outside of function definition", \\var handle_undef: promise = undefined; \\var handle_dummy: promise = @handle(); |
