Hello, I just started Zig like 15 minutes ago, and im currently learning about tagged enums. I am familiar with sum types because i've written rust code before, but i dont understnad the error im getting. this is my code:
test "tagged unions" {
const RustOptionInt = union(enum) {
none,
some: i32,
};
var maybe_int = RustOptionInt.none;
switch (maybe_int) {
.none => {},
.some => |*value| value.* += 1,
}
try expect(maybe_int == RustOptionInt.none);
}
and this is the error i get:
main.zig:75:35: error: incompatible types: '@typeInfo(main.test.tagged unions.RustOptionInt).Union.tag_type.?' and 'comptime_int'
.some => |*value| value.* += 1,
~~~~~~~~^~~~
main.zig:75:32: note: type '@typeInfo(main.test.tagged unions.RustOptionInt).Union.tag_type.?' here
.some => |*value| value.* += 1,
~~~~~^~
main.zig:75:38: note: type 'comptime_int' here
.some => |*value| value.* += 1,
^
can someone please explain to me what is going on?
