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

"expected optional type" error points at wrong part #13097

Closed
wooster0 opened this issue Oct 7, 2022 · 1 comment
Closed

"expected optional type" error points at wrong part #13097

wooster0 opened this issue Oct 7, 2022 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@wooster0
Copy link
Contributor

wooster0 commented Oct 7, 2022

Zig Version

0.10.0-dev.4247+3234e8de3

Steps to Reproduce

pub fn main() void {
    if (1) |x| _ = x;
}

Expected Behavior

$ zig run x.zig
x.zig:2:18: error: expected optional type, found 'comptime_int'
    if (1) |x| _ = x;
        ^

Actual Behavior

$ zig run x.zig
x.zig:2:18: error: expected optional type, found 'comptime_int'
    if (1) |x| _ = x;
               ~~^~~

stage1 gets it right:

$ zig run x.zig -fstage1
./x.zig:2:9: error: expected optional type, found 'comptime_int'
    if (1) |x| _ = x;
        ^
@wooster0 wooster0 added the bug Observed behavior contradicts documented or intended behavior label Oct 7, 2022
@Vexu
Copy link
Member

Vexu commented Oct 7, 2022

Same cause as #13023

@Vexu Vexu closed this as completed Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

2 participants