Safely check for suspend function parent
The issue here is that the function can be in unlowered file, and thus its parent package fragment and not class. #KT-49317 Fixed
This commit is contained in:
+6
@@ -10179,6 +10179,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49168.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49317.kt")
|
||||
public void testKt49317() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49317.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49645.kt")
|
||||
public void testKt49645() throws Exception {
|
||||
|
||||
+2
-2
@@ -38,9 +38,9 @@ private fun IrFunction.isInvokeOfSuspendCallableReference(): Boolean =
|
||||
&& parentAsClass.origin == JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL
|
||||
|
||||
private fun IrFunction.isBridgeToSuspendImplMethod(): Boolean =
|
||||
isSuspend && this is IrSimpleFunction && parentAsClass.functions.any {
|
||||
isSuspend && this is IrSimpleFunction && (parent as? IrClass)?.functions?.any {
|
||||
it.name.asString() == name.asString() + SUSPEND_IMPL_NAME_SUFFIX && it.attributeOwnerId == attributeOwnerId
|
||||
}
|
||||
} == true
|
||||
|
||||
private fun IrFunction.isStaticInlineClassReplacementDelegatingCall(): Boolean {
|
||||
if (this !is IrAttributeContainer || isStaticInlineClassReplacement) return false
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
// FILE: 2.kt
|
||||
package other
|
||||
import builders.*
|
||||
import kotlin.coroutines.*
|
||||
|
||||
fun test() {
|
||||
suspend {
|
||||
foo { }
|
||||
}.startCoroutine(Continuation(EmptyCoroutineContext) {
|
||||
it.getOrThrow()
|
||||
})
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
test()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
package builders
|
||||
|
||||
suspend fun foo(
|
||||
a: suspend () -> Unit = {}
|
||||
) {}
|
||||
+6
@@ -10053,6 +10053,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49168.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49317.kt")
|
||||
public void testKt49317() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49317.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49645.kt")
|
||||
public void testKt49645() throws Exception {
|
||||
|
||||
+6
@@ -10179,6 +10179,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49168.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49317.kt")
|
||||
public void testKt49317() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49317.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49645.kt")
|
||||
public void testKt49645() throws Exception {
|
||||
|
||||
+5
@@ -7914,6 +7914,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt46813.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt49317.kt")
|
||||
public void testKt49317() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49317.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt49645.kt")
|
||||
public void testKt49645() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49645.kt");
|
||||
|
||||
+6
@@ -7157,6 +7157,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49168.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49317.kt")
|
||||
public void testKt49317() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49317.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt51530.kt")
|
||||
public void testKt51530() throws Exception {
|
||||
|
||||
+6
@@ -7199,6 +7199,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49168.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49317.kt")
|
||||
public void testKt49317() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49317.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt51530.kt")
|
||||
public void testKt51530() throws Exception {
|
||||
|
||||
+5
@@ -6241,6 +6241,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49168.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt49317.kt")
|
||||
public void testKt49317() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49317.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt51530.kt")
|
||||
public void testKt51530() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt51530.kt");
|
||||
|
||||
+6
@@ -8041,6 +8041,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49168.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49317.kt")
|
||||
public void testKt49317() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/kt49317.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt51530.kt")
|
||||
public void testKt51530() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user