Corrected this test, and added the incorrect test as a new regression test.
That said, the new fix is more expedient than perfect -- it'll throw an incorrect lint here:
foo <- function() {
if (TRUE) {
if (TRUE) {
return(1)
}
2
} else {
3
}
(the return() is a valid early return within that branch).
But as this issue is not relevant to the implicit else returns feature, I'm pushing to follow-up.
Originally posted by @MichaelChirico in #2321 (comment)