Switch on implicitly unwrapped optional enum variable should not require a .none case #74515
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
pattern matching
Feature: pattern matching
type checker
Area → compiler: Semantic analysis
Description
When we switch on an implicitly unwrapped optional enum variable, a .none case should not be required because the enum variable should be unwrapped before the switch happens. Hence the .none case should not be reachable.
Reproduction
The following code does not compile. The compiler wants me to add a .none case when switching on an implicitly unwrapped optional variable.
Error: switch must be exhaustive
Note: add missing case: '.none'
Expected behavior
The code below compiles without errors:
Environment
5
Additional information
No response
The text was updated successfully, but these errors were encountered: