We should only insert a return statement at the end of a lambda or
function if the final statement is used as an expression (slice
USED_AS_RESULT_OF_LAMBDA and USED_AS_EXPRESSION).
Such references require proper scope so that local symbols are bound.
Example:
```
fun <T> outer() {
abstract class ALocal<S : T> {
abstract fun bar()
}
class Local<S : T> : ALocal<S>() {
override fun bar() {}
}
}
```
Here local classes have type parameters with upper bounds depending on
function type parameters, and members overriding members in other local
classes.
Argument matching status can be considered an "error" in resolve,
even though it is not a compilation error and doesn't prevent code
from being generated.
Actually, we should only check if the argument matching status is
ArgumentMatch.
#KT-18294 Fixed