-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
When an enum contains aliases for a member, these aliases are currently required to be covered in exhaustive case:
enum Foo
Bar
Qux
Baz = Qux
end
case Foo::Bar # Error: case is not exhaustive for enum Foo. Missing members: - Baz
in Foo::Bar
in Foo::Qux
endThis is rather inconvenient when Baz is an alias for Qux and both are supposed to be useable interchangeably.
A use case for this would be changing a member's name by adding a new member and keeping the old one as a deprecated alias (example: in #16354 we'd like to rename Redirect::Close to Redirect::Null).
The addition of an alias should not have an effect on exhaustive case behaviour.
There is a possibility that two members happen to share the same value, but are not exactly aliases. This could be the case for example when the values are defined externally, or may vary depending or depend on some configuration.
However, enums with flexible members are not relevant for exhaustive case, so it should be fine to ignore this. Just like we ignore arbitrary enum members like Foo.new(42) created at runtime.
Add a 👍 reaction to issues you find important.