Closed jshier closed 3 months ago
I can't reproduce the Never
in generics case outside of a TCA example:
@CasePathable
enum Action {
case alert(AlertState<Never> .Action)
}
@Reducer
struct Feature2 {}
This produces the same warning. If I use my own generic type, even with a child type, it doesn't warn.
Perhaps the issue is related to the fact that a PartialCasePath<Never>
can't be instantiated?
Thanks for the report! Luckily we can work around it by ditching the switch
and leveraging CasePathable.is
, but the warning is strange and I'm not sure if a bug should be filed with Apple.
@jshier Since this is just producing a warning, we'll probably not cut a release immediately after merging, and instead let the dust settle on the 1.4 release a little longer just in case there are other issues lurking.
Starting in 1.4.0, enums with
Never
associated values, even as part of a generic type, trigger some sort of compiler bug (or misleading diagnostic) where it thinks switches on the enum may have unknown values. For example:produces the warning
Switch covers known cases, but 'Action' may have additional unknown values
in its generated code. More specifically:This enum compiles cleanly if any other type is used as an associated value.
Environment
Edited to simplify example.