JVM_IR KT-47510 indy callee parent is a package fragment, not a class

This commit is contained in:
Dmitry Petrov
2021-06-29 12:17:48 +03:00
committed by TeamCityServer
parent a54e758189
commit 68c3f30aa7
6 changed files with 50 additions and 3 deletions
@@ -21431,6 +21431,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/invokedynamic/sam/kt45779.kt");
}
@Test
@TestMetadata("kt47510.kt")
public void testKt47510() throws Exception {
runTest("compiler/testData/codegen/box/invokedynamic/sam/kt47510.kt");
}
@Test
@TestMetadata("nullabilityAssertions.kt")
public void testNullabilityAssertions() throws Exception {
@@ -670,9 +670,14 @@ class ExpressionCodegen(
// Otherwise, we need to treat `Result` as boxed if it overrides a non-`Result` or boxed `Result` type.
// TODO: if results of `needsResultArgumentUnboxing` for `overriddenSymbols` are inconsistent, the boxedness
// of the `Result` depends on which overridden function is called. This is probably unfixable.
return parentAsClass.functions.none {
it != this && it.origin == IrDeclarationOrigin.BRIDGE && it.attributeOwnerId == attributeOwnerId
} && overriddenSymbols.any { it.owner.resultIsActuallyAny(index) != false }
val parent = this.parent
return parent is IrClass &&
parent.functions.none {
it != this && it.origin == IrDeclarationOrigin.BRIDGE && it.attributeOwnerId == attributeOwnerId
} &&
overriddenSymbols.any {
it.owner.resultIsActuallyAny(index) != false
}
}
override fun visitFieldAccess(expression: IrFieldAccessExpression, data: BlockInfo): PromisedValue {
@@ -0,0 +1,19 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FULL_JDK
import java.util.concurrent.Executor
import kotlin.coroutines.Continuation
import kotlin.coroutines.CoroutineContext
class Wrapper<T>(val pool: Executor, private val cont: Continuation<T>) : Continuation<T> {
override val context: CoroutineContext
get() = cont.context
override fun resumeWith(result: Result<T>) {
// Check that there's no compiler exception here
pool.execute { cont.resumeWith(result) }
}
}
fun box() = "OK"
@@ -21389,6 +21389,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/invokedynamic/sam/kt45779.kt");
}
@Test
@TestMetadata("kt47510.kt")
public void testKt47510() throws Exception {
runTest("compiler/testData/codegen/box/invokedynamic/sam/kt47510.kt");
}
@Test
@TestMetadata("nullabilityAssertions.kt")
public void testNullabilityAssertions() throws Exception {
@@ -21431,6 +21431,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/invokedynamic/sam/kt45779.kt");
}
@Test
@TestMetadata("kt47510.kt")
public void testKt47510() throws Exception {
runTest("compiler/testData/codegen/box/invokedynamic/sam/kt47510.kt");
}
@Test
@TestMetadata("nullabilityAssertions.kt")
public void testNullabilityAssertions() throws Exception {
@@ -17874,6 +17874,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/invokedynamic/sam/kt45779.kt");
}
@TestMetadata("kt47510.kt")
public void testKt47510() throws Exception {
runTest("compiler/testData/codegen/box/invokedynamic/sam/kt47510.kt");
}
@TestMetadata("nullabilityAssertions.kt")
public void testNullabilityAssertions() throws Exception {
runTest("compiler/testData/codegen/box/invokedynamic/sam/nullabilityAssertions.kt");