[IR] Correct line number on suspend function with implicit unit return
This commit is contained in:
committed by
max-kammerer
parent
c2fec38384
commit
297c33b452
+1
-1
@@ -39,7 +39,7 @@ private class TailCallOptimizationLowering(private val context: JvmBackendContex
|
|||||||
override fun visitCall(expression: IrCall, data: TailCallOptimizationData?): IrExpression {
|
override fun visitCall(expression: IrCall, data: TailCallOptimizationData?): IrExpression {
|
||||||
val transformed = super.visitCall(expression, data) as IrExpression
|
val transformed = super.visitCall(expression, data) as IrExpression
|
||||||
return if (data == null || expression !in data.tailCalls) transformed else IrReturnImpl(
|
return if (data == null || expression !in data.tailCalls) transformed else IrReturnImpl(
|
||||||
expression.startOffset, expression.endOffset, context.irBuiltIns.nothingType, data.function.symbol,
|
data.function.endOffset, data.function.endOffset, context.irBuiltIns.nothingType, data.function.symbol,
|
||||||
if (data.returnsUnit) transformed.coerceToUnit() else transformed
|
if (data.returnsUnit) transformed.coerceToUnit() else transformed
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// WITH_COROUTINES
|
||||||
|
// FILE: test.kt
|
||||||
|
suspend fun foo(block: Long.() -> String): String {
|
||||||
|
return 1L.block()
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun box() {
|
||||||
|
foo {
|
||||||
|
"OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// LINENUMBERS
|
||||||
|
// test.kt:8 box
|
||||||
|
// test.kt:4 foo
|
||||||
|
// test.kt:9 invoke
|
||||||
|
// test.kt:4 foo
|
||||||
|
// test.kt:8 box
|
||||||
|
// test.kt:11 box
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// WITH_COROUTINES
|
||||||
|
// FILE: test.kt
|
||||||
|
suspend fun foo(block: suspend Long.() -> String): String {
|
||||||
|
return 1L.block()
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun box() {
|
||||||
|
foo {
|
||||||
|
"OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// LINENUMBERS
|
||||||
|
// test.kt:8 box
|
||||||
|
// test.kt:4 foo
|
||||||
|
// CoroutineUtil.kt:28 getContext
|
||||||
|
// test.kt:-1 <init>
|
||||||
|
// test.kt:-1 create
|
||||||
|
// test.kt:-1 invoke
|
||||||
|
// test.kt:8 invokeSuspend
|
||||||
|
// test.kt:9 invokeSuspend
|
||||||
|
// test.kt:-1 invoke
|
||||||
|
// test.kt:4 foo
|
||||||
|
// test.kt:8 box
|
||||||
|
// test.kt:11 box
|
||||||
+12
@@ -379,6 +379,18 @@ public class IrSteppingTestGenerated extends AbstractIrSteppingTest {
|
|||||||
runTest("compiler/testData/debug/stepping/stringSwitchesSmall.kt");
|
runTest("compiler/testData/debug/stepping/stringSwitchesSmall.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("suspendFunWithLambdaParameter.kt")
|
||||||
|
public void testSuspendFunWithLambdaParameter() throws Exception {
|
||||||
|
runTest("compiler/testData/debug/stepping/suspendFunWithLambdaParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("suspendFunWithSuspendLambdaParameter.kt")
|
||||||
|
public void testSuspendFunWithSuspendLambdaParameter() throws Exception {
|
||||||
|
runTest("compiler/testData/debug/stepping/suspendFunWithSuspendLambdaParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("throwException.kt")
|
@TestMetadata("throwException.kt")
|
||||||
public void testThrowException() throws Exception {
|
public void testThrowException() throws Exception {
|
||||||
|
|||||||
+12
@@ -379,6 +379,18 @@ public class SteppingTestGenerated extends AbstractSteppingTest {
|
|||||||
runTest("compiler/testData/debug/stepping/stringSwitchesSmall.kt");
|
runTest("compiler/testData/debug/stepping/stringSwitchesSmall.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("suspendFunWithLambdaParameter.kt")
|
||||||
|
public void testSuspendFunWithLambdaParameter() throws Exception {
|
||||||
|
runTest("compiler/testData/debug/stepping/suspendFunWithLambdaParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("suspendFunWithSuspendLambdaParameter.kt")
|
||||||
|
public void testSuspendFunWithSuspendLambdaParameter() throws Exception {
|
||||||
|
runTest("compiler/testData/debug/stepping/suspendFunWithSuspendLambdaParameter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("throwException.kt")
|
@TestMetadata("throwException.kt")
|
||||||
public void testThrowException() throws Exception {
|
public void testThrowException() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user