Fix unmatched returns dialyzer warnings

Fixes unmatched returns dialyzer warnings from #2478.

Generated erlang issues:
* There are still warnings for `for` comprehensions when matched against an empty variable.
* Unmatched returns for `cond` expressions report the wrong line (the line of the first clause).