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

Missing error for sole declaration in a case block of the switch statement #4246

Open
flysand7 opened this issue Sep 15, 2024 · 0 comments
Open

Comments

@flysand7
Copy link
Contributor

Context

  • Odin: dev-2024-09:d2d202673
  • OS: Windows 10 Unknown Edition (00000064) (version: 22H2), build 19045.4780
  • CPU: 12th Gen Intel(R) Core(TM) i5-12500H
  • RAM: 16088 MiB
  • Backend: LLVM 18.1.8

Whenever a declaration is a sole statement inside a statement scope, the compiler displays an error about declaration not being used. This error, however is not displayed for switch statements.

Repro

Typecheck the following code:

package bug
main :: proc() {
  switch {
    case 1==1: a := 3 // Compiler doesn't complain
  }
}
$ odin check examples/bug

The compiler finishes without any errors, one error expected.

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

No branches or pull requests

2 participants