Don't add double linenumber when return expression is absent (KT-18949)

#KT-18949 Fixed
This commit is contained in:
Nikolay Krasko
2017-07-15 16:21:51 +03:00
parent a41c9d2476
commit d282f14eac
5 changed files with 31 additions and 4 deletions
@@ -1613,11 +1613,12 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
// If it does not end with return we should return something
// because if we don't there can be VerifyError (specific cases with Nothing-typed expressions)
if (!endsWithReturn(expr)) {
markLineNumber(expr, true);
if (isLambdaVoidBody(expr, typeForExpression)) {
markLineNumber((KtFunctionLiteral) expr.getParent(), true);
}
else {
markLineNumber(expr, true);
}
if (typeForExpression.getSort() == Type.VOID) {
StackValue.none().put(returnType, v);