Skip to content

detect when switch on error shadows it's own switch case capture #24574

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Techatrix
Copy link
Contributor

zig ast-check fails to report the right error message for this code:

e catch |err| switch (err) {
    error.Foo => |err| {
        _ = err catch {};
    },
};

It does not detect that there are two declarations of err and reports that the inner err capture isn't used. This bug happens with the "switch on captured error" syntax pattern which checked the wrong scope for shadowing.

@Techatrix
Copy link
Contributor Author

Anyone got an idea what would cause the x86_64-windows-release CI to just hang?

@andrewrk
Copy link
Member

We've really suffered too long without #19821 being implemented

@mlugg
Copy link
Member

mlugg commented Aug 1, 2025

Triggered a re-run since that timeout... probably wasn't your fault? We'll see!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants