I just ran into a variation on the following problem: Suppose I have a data type
enum A { B, C}
and some code somewhere else like:
alt check foo {
A {...}
B {...}
}
This says "I know that foo can't be in variant C". But what if I add a new variant D to A? Perhaps I really should add a case to the alt for D (since foo could now be in variant D), but the compiler gives me zero help in this case.
I propose an attribute called no_omit (actually, I don't really care what it's called) to be used like:
enum A { B, C, #[no_omit] D}
which has the effect of generating a warning if any alt check expressions omit the case for D. (I'm not too opinionated about whether it should be a lint warning or an error, so long as there's some way to enable it.) I expect the attribute would be used temporarily, during development, and then removed once the refactor that introduces D is completed.
I just ran into a variation on the following problem: Suppose I have a data type
enum A { B, C}and some code somewhere else like:
This says "I know that
foocan't be in variantC". But what if I add a new variantDtoA? Perhaps I really should add a case to thealtforD(sincefoocould now be in variantD), but the compiler gives me zero help in this case.I propose an attribute called
no_omit(actually, I don't really care what it's called) to be used like:enum A { B, C, #[no_omit] D}which has the effect of generating a warning if any
alt checkexpressions omit the case forD. (I'm not too opinionated about whether it should be a lint warning or an error, so long as there's some way to enable it.) I expect the attribute would be used temporarily, during development, and then removed once the refactor that introducesDis completed.