diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-09-17 23:21:22 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-09-17 23:21:22 -0400 |
| commit | dbc202cc6a3bcaffb2f6528551d6dd0a62a6b5a3 (patch) | |
| tree | 4666bd5fbe143025658b3280437530feabffe1cc | |
| parent | c5ca8b51f9151d24fd70686599b049749139e023 (diff) | |
| download | zig-dbc202cc6a3bcaffb2f6528551d6dd0a62a6b5a3.tar.gz zig-dbc202cc6a3bcaffb2f6528551d6dd0a62a6b5a3.zip | |
add test for struct with invalid field
see #468
| -rw-r--r-- | test/compile_errors.zig | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index ca3cb64724..a8a4a96e8d 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2127,4 +2127,30 @@ pub fn addCases(cases: &tests.CompileErrorContext) { , ".tmp_source.zig:2:33: error: expected type 'GlobalLinkage', found 'u32'"); + cases.add("struct with invalid field", + \\const std = @import("std"); + \\const Allocator = std.mem.Allocator; + \\const ArrayList = std.ArrayList; + \\ + \\const HeaderWeight = enum { + \\ H1, H2, H3, H4, H5, H6, + \\}; + \\ + \\const MdText = ArrayList(u8); + \\ + \\const MdNode = enum { + \\ Header: struct { + \\ text: MdText, + \\ weight: HeaderValue, + \\ }, + \\}; + \\ + \\export fn entry() { + \\ const a = MdNode.Header { + \\ .text = MdText.init(&std.debug.global_allocator), + \\ .weight = HeaderWeight.H1, + \\ }; + \\} + , + ".tmp_source.zig:14:17: error: use of undeclared identifier 'HeaderValue'"); } |
