Match case incorrectly marked as unreachable, and the wrong case is executed #599
Labels
accepting contributions
Issues that are suitable to be worked on by anybody, not just maintainers
bug
Defects, unintended behaviour, etc
compiler
Changes related to the compiler
Milestone
Please describe the bug
When compiling certain pattern match expressions, the compiler incorrectly flags certain cases as unreachable, even though they are in fact reachable. In addition, it seems the wrong branch is taken at runtime. This only happens when one case covers a pattern but uses a guard, and another case also covers the pattern but without a guard.
Please list the exact steps necessary to reproduce the bug
Run this code:
This produces a warning that
case 20 -> ...
is unreachable, and when run the output in STDOUT is10
instead of20
. The expected result i no warnings, and20
in STDOUT.Operating system
Fedora Silverblue 38
Inko version
main
Rust version
1.70.0
Related issues
The text was updated successfully, but these errors were encountered: