Fixed unreachableCode message if a lambda is returned (#6008).