We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
*Enum
*TaggedUnion
Consider the following code:
const Foo = union(enum) { a: i32, b: []const u8, fn deinit(self: *Foo, alloc: Allocator) void { // WRONG! switching over pointer, not enum // should be `switch(self.*)` switch(self) { .a => {}, // noop .b => alloc.free(self.b), } } };
The zig compiler provides this error message:
example.zig:8:5: error: else prong required when switching on type '*src.example.Foo' switch (self) {
This message isn't great. Ideally it would have a note saying "did you forget to dereference this pointer?"
We should add a rule that checks for this.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Consider the following code:
The zig compiler provides this error message:
This message isn't great. Ideally it would have a note saying "did you forget to dereference this pointer?"
We should add a rule that checks for this.
The text was updated successfully, but these errors were encountered: