Don't add double linenumber when return expression is absent (KT-18949)
#KT-18949 Fixed
This commit is contained in:
@@ -1613,11 +1613,12 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
// If it does not end with return we should return something
|
// 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)
|
// because if we don't there can be VerifyError (specific cases with Nothing-typed expressions)
|
||||||
if (!endsWithReturn(expr)) {
|
if (!endsWithReturn(expr)) {
|
||||||
markLineNumber(expr, true);
|
|
||||||
|
|
||||||
if (isLambdaVoidBody(expr, typeForExpression)) {
|
if (isLambdaVoidBody(expr, typeForExpression)) {
|
||||||
markLineNumber((KtFunctionLiteral) expr.getParent(), true);
|
markLineNumber((KtFunctionLiteral) expr.getParent(), true);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
markLineNumber(expr, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (typeForExpression.getSort() == Type.VOID) {
|
if (typeForExpression.getSort() == Type.VOID) {
|
||||||
StackValue.none().put(returnType, v);
|
StackValue.none().put(returnType, v);
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
fun foo() {
|
||||||
|
bar {
|
||||||
|
nop()
|
||||||
|
baz()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun bar(f: () -> Unit) {
|
||||||
|
nop()
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun baz() {
|
||||||
|
nop()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun nop() {}
|
||||||
|
|
||||||
|
// 2 20 21 3 4 25 26 5 27 6 9 10 11 14 15 17
|
||||||
@@ -209,6 +209,12 @@ public class LineNumberTestGenerated extends AbstractLineNumberTest {
|
|||||||
doTestCustom(fileName);
|
doTestCustom(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inTheEndOfLambdaArgumentOfInlineCall.kt")
|
||||||
|
public void testInTheEndOfLambdaArgumentOfInlineCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/inTheEndOfLambdaArgumentOfInlineCall.kt");
|
||||||
|
doTestCustom(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("multilineFunctionCall.kt")
|
@TestMetadata("multilineFunctionCall.kt")
|
||||||
public void testMultilineFunctionCall() throws Exception {
|
public void testMultilineFunctionCall() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/multilineFunctionCall.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/multilineFunctionCall.kt");
|
||||||
|
|||||||
+1
-1
@@ -5,4 +5,4 @@ fun main(args: Array<String>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ADDITIONAL_BREAKPOINT: functionInLibrary.kt:public inline fun simpleFun()
|
// ADDITIONAL_BREAKPOINT: functionInLibrary.kt:public inline fun simpleFun()
|
||||||
// STEP_INTO: 4
|
// STEP_INTO: 5
|
||||||
+2
-1
@@ -2,7 +2,8 @@ LineBreakpoint created at soInlineCallInLastStatementInInlineFunctionArgumentDex
|
|||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
soInlineCallInLastStatementInInlineFunctionArgumentDex.kt:7
|
soInlineCallInLastStatementInInlineFunctionArgumentDex.kt:7
|
||||||
soInlineCallInLastStatementInInlineFunctionArgumentDex.kt:7
|
soInlineCallInLastStatementInInlineFunctionArgumentDex.kt:8
|
||||||
|
soInlineCallInLastStatementInInlineFunctionArgumentDex.kt:14
|
||||||
soInlineCallInLastStatementInInlineFunctionArgumentDex.kt:9
|
soInlineCallInLastStatementInInlineFunctionArgumentDex.kt:9
|
||||||
Disconnected from the target VM
|
Disconnected from the target VM
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user