The compileError or comptime unreachable only tell that you made a mistake, not where. The pattern @Sze showed would tell you where you made the mistake. Though, the compile error will be a little more cryptic (being a type mismatch, instead of unreachable).
I think more information is well worth it, especially in a large piece of code like the real example you linked.
Also, will explicitly state these patterns apply not just to switch’s but any time you have multiple branches that all must return.
I don’t think this applies to the example OP gave, since it was concrete, and every switch prong returned unconditionally. It would be perfectly safe to consider the final return statements as unreachable, as it wouldn’t limit any kind of generic programming or conditional compilation. I think if they could implement this detection and flag it as a compiler error, they would.
It explains why the behaviour exists at all, ‘to allow you to write code that specialises at comptime’.
But this is certainly an uncaught edge case. I don’t see any reason it couldn’t be caught, but it is also a bug that is annoying not breaking so it is not a high priority.