Skip to content

else prong works even when it is exhaustive switch stage1 #7120

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

Closed
g-w1 opened this issue Nov 16, 2020 · 2 comments
Closed

else prong works even when it is exhaustive switch stage1 #7120

g-w1 opened this issue Nov 16, 2020 · 2 comments
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Milestone

Comments

@g-w1
Copy link
Contributor

g-w1 commented Nov 16, 2020

This works:

pub fn main() void {
  const x = error.T;
  switch (x) {
    error.T => {},
    else => {}
  }
}

but it should not allow else because @TypeOf(x) == error { T } (according to @compileLog) so else is unreachable. I will try to fix this.

@Vexu
Copy link
Member

Vexu commented Nov 16, 2020

This was intentionally left out when the error for unreachable else prongs was added (#5693) since it caused issues generic code.

@Vexu Vexu added the enhancement Solving this issue will likely involve adding new logic or components to the codebase. label Nov 16, 2020
@Vexu Vexu added this to the 0.9.0 milestone Nov 16, 2020
@g-w1
Copy link
Contributor Author

g-w1 commented Nov 16, 2020

Ah, well ill let the other pr handle this, thanks.

@g-w1 g-w1 closed this as completed Nov 16, 2020
@Vexu Vexu removed this from the 0.9.0 milestone Dec 28, 2020
@andrewrk andrewrk added this to the 0.8.0 milestone Jan 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Projects
None yet
Development

No branches or pull requests

3 participants