fix struct inside function referencing local const

closes #672

the crash and compile errors are fixed but structs
inside functions still get named after the functions
they're in. this will be fixed later.
This commit is contained in:
Andrew Kelley
2018-01-07 00:20:26 -05:00
parent ad438cfd40
commit bb39e503c0
4 changed files with 81 additions and 43 deletions

View File

@@ -1,6 +1,18 @@
const tests = @import("tests.zig");
pub fn addCases(cases: &tests.CompileErrorContext) {
cases.add("bad identifier in function with struct defined inside function which references local const",
\\export fn entry() {
\\ const BlockKind = u32;
\\
\\ const Block = struct {
\\ kind: BlockKind,
\\ };
\\
\\ bogus;
\\}
, ".tmp_source.zig:8:5: error: use of undeclared identifier 'bogus'");
cases.add("labeled break not found",
\\export fn entry() {
\\ blah: while (true) {