Fixes Bug 23189 by adding additional checks in DeduceFunctionTypeFromReturnExpr.
Without these checks, the code attempts to dereference a null pointer when trying to infer the return type of a lambda if there are multiple return statements and one of them contains an expression with an undeclared identifier.
Dependent types are supposed to be eliminated by this check. I think the right thing to do is to correct typos in the expression before we get to this point.