#Unable to resolve inferred error set

1 messages · Page 1 of 1 (latest)

edgy geyser
#

I ran into this issue today where the compiler is suddenly unable to resolve the error set. It was working just a week ago or so
My zig version: 0.12.0-dev.3123+147beec7d

code:

  try self.do(.{ .connect = .{ .from = connection_from.objs, .to = new.objs[0] } });
pub fn do(self: *Editor, action: Editor.Action) !void {
    const result = try self.execute_action(action);
    self.history.push(result);
    self.action_stack.clear();
}
fn execute_action(self: *Editor, action: Editor.Action) !ActionResult {
  switch (action) {
    // a big switch statement with a bunch of stuff that may return error inside like:
    .button => |args| {
      try self.toggle_button(args.btn);
      return ActionResult{ .button = .{ .btn = args.btn } };
    }, 
  }
#

oh and for some reason it doesn't work only in one specific function:

pub fn updateGroupSelection(self: *Editor, maybe_new: ?Selection) !void {
    const sel = self.selected orelse {
        self.setGroupSelection(maybe_new);
        return;
    };

    const new = maybe_new orelse {
        self.setGroupSelection(null);
        return;
    };

    if (new.type != sel.type) {
        self.setGroupSelection(new);
        return;
    }

    switch (sel.type) {
        .gate => {
            if (new.objs.len == 1 and sel.objs.len > 0) {
                const connection_from = try sel.dupe();
                // HERE
                try self.do(.{ .connect = .{
                    .from = connection_from.objs,
                    .to = new.objs[0],
                } });

                new.deinit();
                self.setGroupSelection(null);
            }
        },
        .group => {
            if (new.objs.len == 1 and sel.objs.len == 1) {
                // TODO: Connect group
            }
        },
    }
}

in other places it works 🤔

restive comet
#

inferred error sets don't support recursion