Skip to content
New issue

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

allow inferred error sets to be empty #4564

Closed
andrewrk opened this issue Feb 26, 2020 · 0 comments · Fixed by #4565
Closed

allow inferred error sets to be empty #4564

andrewrk opened this issue Feb 26, 2020 · 0 comments · Fixed by #4565
Labels
accepted This proposal is planned. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone

Comments

@andrewrk
Copy link
Member

test case:

fn foo() !void {}

test "" {
    foo() catch |err| switch (err) {};
}

status quo:

$ ./zig test test2.zig 
./test2.zig:1:11: error: function with inferred error set must return at least one possible error
fn foo() !void {}
          ^
./test2.zig:4:11: note: referenced here
    foo() catch |err| switch (err) {};
          ^

accepted proposal:

$ ./zig test test2.zig 
All 1 tests passed.

It would be equivalent to this code:

fn foo() error{}!void {}

test "" {
    foo() catch |err| switch (err) {};
}
@andrewrk andrewrk added contributor friendly This issue is limited in scope and/or knowledge of Zig internals. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. accepted This proposal is planned. labels Feb 26, 2020
@andrewrk andrewrk added this to the 0.7.0 milestone Feb 26, 2020
LemonBoy added a commit to LemonBoy/zig that referenced this issue Feb 26, 2020
FireFox317 added a commit to FireFox317/zig that referenced this issue Feb 26, 2020
andrewrk pushed a commit that referenced this issue Feb 27, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.6.0 Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted This proposal is planned. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned.
Projects
None yet
1 participant