You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
“The compiler is unable to check that this switch is exhaustive in reasonable time”
Sometimes I do not want to add a `default:` case.
So it would be nice if the possible "fix" choices included, “go ahead and use an ‘unreasonable’ amount of time please” and then when it figured out that the switch was not exhaustive it could prompt to fix by generating the missing cases (which can be laborious by hand).
Example use case: I have an enum with associated values of differing types and quite a few cases. I have to write my own operator == in order to make it Equatable. In that scenario I want the compiler to warn me if I add a new enum case and forget to add the comparison case for it in the switch statement in the == implementation.
What I'd like to do is have the compiler generate all the possible combinations for me given the current definition so that I can be explicit about returning false for those and avoid using default: which prevents the compiler from helping me if I forget to add a case to the operator == implementation.
In simpler situations the compiler will offer to do this but I guess in the one in question it took too long to do the checking, presented the error above, and I wasn't given the opportunity to have the compiler generate the lengthy all possible cases code for me.
TIA.
The text was updated successfully, but these errors were encountered:
Attachment: Download
Additional Detail from JIRA
md5: abfcbf265d46a7b46c8eeaf39eb0b0fd
Issue Description:
When I get the error:
“The compiler is unable to check that this switch is exhaustive in reasonable time”
Sometimes I do not want to add a `default:` case.
So it would be nice if the possible "fix" choices included, “go ahead and use an ‘unreasonable’ amount of time please” and then when it figured out that the switch was not exhaustive it could prompt to fix by generating the missing cases (which can be laborious by hand).
Example use case: I have an enum with associated values of differing types and quite a few cases. I have to write my own operator == in order to make it Equatable. In that scenario I want the compiler to warn me if I add a new enum case and forget to add the comparison case for it in the switch statement in the == implementation.
What I'd like to do is have the compiler generate all the possible combinations for me given the current definition so that I can be explicit about returning false for those and avoid using default: which prevents the compiler from helping me if I forget to add a case to the operator == implementation.
In simpler situations the compiler will offer to do this but I guess in the one in question it took too long to do the checking, presented the error above, and I wasn't given the opportunity to have the compiler generate the lengthy all possible cases code for me.
TIA.
The text was updated successfully, but these errors were encountered: