min reproducer of brilck missed error - #460
Conversation
|
Thanks for putting this together! This is a deceptively interesting one, because enforcing the absence of "fall-through returns" in non-void functions is hard-ish to do in general. For example: That program has an appropriate A precise check for this error would have some trouble distinguishing these two cases. To summarize:
Anyway, I'll add a check for item 1 now. If you agree that item 3 is worth pursuing, maybe we should just file an issue for exploring that enhancement to brilck? |
|
I folded your test into the brilck feature PR, #461! Thank you! |
Ah this was harder than I expected. I implemented 1 as well for For 3, a precise enough analysis seems challenging. Maybe here is another example that doesn't rely on deadcode that should be allowed? There could be a style-driven "no obviously dead code" in the benchmark suite check but I'm not sure that it is worth pursuing. |
|
Yeah, that's a good point. I think it's not terribly clear what the static counterpart to the dynamic requirement ("non-void functions must return something") ought to be! |
Here is a minimal reproducible example that I believe is both a type error and missed by brilck. This was found in #459 and was introduced in #448. Note that I have made a slight change from the original error to make the minimal example not dead code, this still exhibits a missing check for when a return type is set, a value is expected to be returned from the function call, but there is no return instruction.