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

Switch statement not type-checking #4244

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

Switch statement not type-checking #4244

Up05 opened this issue Sep 15, 2024 · 0 comments
Labels

Comments

@Up05
Copy link

Up05 commented Sep 15, 2024

Context

Odin:    dev-2024-08-nightly:8359995
OS:      CachyOS, Linux 6.10.6-2-cachyos
CPU:     Quad-Core Processor (up to 1.4GHz)
RAM:     3354 MiB
Backend: LLVM 18.1.8

Expected Behavior

r := 'a'
switch r {
    case r > '0':
}

Should throw a mismatched-types compile error, since we are comparing rune to bool

Current Behavior

r > '0' is converted to true/1/'0x01' and then compared against 'a'.

Failure Information (for bugs)

switch "12" { case [2] int { 50, 51 }: } // causes an inconvertable type error.
switch 1 { case [2] int { 50, 51 }: } // compiles and runs (but may be because of array-programming)
switch true { case 1: } // similar error to previous
@gingerBill gingerBill added the bug label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants