| author | |
| committer | |
| log | aacff8c80091c0187057e65d96108f46962f98a3 |
| tree | 22c59cf724f036d55fcdacc33adad24c9969ecff |
| parent | 7b8a7989ef54b7ac859035cbc603b8012f8f4102 |
2 files changed, 19 insertions(+), 2 deletions(-)
test/cases/compile_errors/enum_field_value_references_enum.zig+3-2| ... | ... | @@ -1,6 +1,8 @@ |
| 1 | 1 | pub const Foo = enum(c_int) { |
| 2 | 2 | A = Foo.B, |
| 3 | 3 | C = D, |
| 4 | ||
| 5 | pub const B = 0; | |
| 4 | 6 | }; |
| 5 | 7 | export fn entry() void { |
| 6 | 8 | const s: Foo = Foo.E; |
| ... | ... | @@ -10,5 +12,4 @@ const D = 1; |
| 10 | 12 | |
| 11 | 13 | // error |
| 12 | 14 | // |
| 13 | // :2:13: error: enum 'tmp.Foo' has no member named 'B' | |
| 14 | // :1:17: note: enum declared here | |
| 15 | // :1:5: error: dependency loop detected |
test/cases/compile_errors/enum_field_value_references_nonexistent_circular.zig created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | pub const Foo = enum(c_int) { | |
| 2 | A = Foo.B, | |
| 3 | C = D, | |
| 4 | }; | |
| 5 | export fn entry() void { | |
| 6 | const s: Foo = Foo.E; | |
| 7 | _ = s; | |
| 8 | } | |
| 9 | const D = 1; | |
| 10 | ||
| 11 | // error | |
| 12 | // backend=stage2 | |
| 13 | // target=native | |
| 14 | // | |
| 15 | // :2:13: error: enum 'tmp.Foo' has no member named 'B' | |
| 16 | // :1:17: note: enum declared here |