KT-27524 Don't box (some) inline classes in suspend fun return
If an inline class is mapped to a reference type (or an array), it's Ok to treat JVM view on a suspend function as returning a value of corresponding inline class (although in reality it returns 'Any?' because of COROUTINE_SUSPENDED).
This commit is contained in:
@@ -37,7 +37,7 @@ interface Callable {
|
||||
|
||||
fun invokeMethodWithArguments(resolvedCall: ResolvedCall<*>, receiver: StackValue, codegen: ExpressionCodegen): StackValue {
|
||||
// it's important to use unsubstituted return type here to unbox value if it comes from type variable
|
||||
return StackValue.functionCall(returnType, resolvedCall.resultingDescriptor.original.returnType) {
|
||||
return StackValue.functionCall(returnType, returnKotlinType ?: resolvedCall.resultingDescriptor.original.returnType) {
|
||||
codegen.invokeMethodWithArguments(this, resolvedCall, receiver)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1648,7 +1648,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
}
|
||||
else {
|
||||
returnType = this.returnType;
|
||||
returnKotlinType = this.context.getFunctionDescriptor().getReturnType();
|
||||
returnKotlinType = typeMapper.getReturnValueType(this.context.getFunctionDescriptor());
|
||||
}
|
||||
StackValue valueToReturn = returnedExpression != null ? gen(returnedExpression) : StackValue.none();
|
||||
|
||||
@@ -1701,7 +1701,10 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
BindingContextUtils.getContainingFunctionSkipFunctionLiterals(descriptor, true).getFirst();
|
||||
//FIRST_FUN_LABEL to prevent clashing with existing labels
|
||||
return new NonLocalReturnInfo(
|
||||
new JvmKotlinType(typeMapper.mapReturnType(containingFunction), containingFunction.getReturnType()),
|
||||
new JvmKotlinType(
|
||||
typeMapper.mapReturnType(containingFunction),
|
||||
typeMapper.getReturnValueType(containingFunction)
|
||||
),
|
||||
FIRST_FUN_LABEL
|
||||
);
|
||||
} else {
|
||||
@@ -1739,7 +1742,9 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
: returnType;
|
||||
|
||||
KotlinType kotlinTypeForExpression =
|
||||
isBlockedNamedFunction || isVoidCoroutineLambda ? null : context.getFunctionDescriptor().getReturnType();
|
||||
isBlockedNamedFunction || isVoidCoroutineLambda
|
||||
? null
|
||||
: typeMapper.getReturnValueType(context.getFunctionDescriptor());
|
||||
|
||||
gen(expr, typeForExpression, kotlinTypeForExpression);
|
||||
|
||||
|
||||
@@ -362,6 +362,19 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun getReturnValueType(functionDescriptor: FunctionDescriptor): KotlinType =
|
||||
getActualReturnTypeForSuspendFunctionWithInlineClassReturnTypeHack(functionDescriptor)
|
||||
?: functionDescriptor.returnType!!
|
||||
|
||||
private fun getActualReturnTypeForSuspendFunctionWithInlineClassReturnTypeHack(functionDescriptor: FunctionDescriptor): KotlinType? {
|
||||
val originalSuspendFunctionForJvmView = functionDescriptor.unwrapInitialDescriptorForSuspendFunction()
|
||||
if (originalSuspendFunctionForJvmView === functionDescriptor) return null
|
||||
val originalReturnType = originalSuspendFunctionForJvmView.returnType!!
|
||||
if (!originalReturnType.isInlineClassType()) return null
|
||||
val jvmReturnType = mapType(originalReturnType)
|
||||
return if (AsmUtil.isPrimitive(jvmReturnType)) null else originalReturnType
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun mapToCallableMethod(
|
||||
descriptor: FunctionDescriptor,
|
||||
@@ -431,7 +444,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
invokeOpcode = INVOKESTATIC
|
||||
val originalDescriptor = descriptor.original
|
||||
signature = mapSignatureSkipGeneric(originalDescriptor, OwnerKind.DEFAULT_IMPLS)
|
||||
returnKotlinType = originalDescriptor.returnType
|
||||
returnKotlinType = getReturnValueType(originalDescriptor)
|
||||
if (descriptor is AccessorForCallableDescriptor<*> && descriptor.calleeDescriptor.hasJvmDefaultAnnotation()) {
|
||||
owner = mapClass(functionParent)
|
||||
isInterfaceMember = true
|
||||
@@ -482,7 +495,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
skipGenericSignature = true,
|
||||
hasSpecialBridge = false
|
||||
)
|
||||
returnKotlinType = functionToCall.returnType
|
||||
returnKotlinType = getReturnValueType(functionToCall)
|
||||
|
||||
val receiver = if (currentIsInterface && !originalIsInterface || functionParent is FunctionClassDescriptor)
|
||||
declarationOwner
|
||||
@@ -495,7 +508,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
} else {
|
||||
val originalDescriptor = functionDescriptor.original
|
||||
signature = mapSignatureSkipGeneric(originalDescriptor)
|
||||
returnKotlinType = originalDescriptor.returnType
|
||||
returnKotlinType = getReturnValueType(originalDescriptor)
|
||||
owner = mapOwner(functionDescriptor)
|
||||
ownerForDefaultImpl = owner
|
||||
baseMethodDescriptor = functionDescriptor
|
||||
|
||||
Generated
+40
@@ -7023,6 +7023,46 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("bridgeGenerationCrossinline.kt")
|
||||
public void testBridgeGenerationCrossinline_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt", "kotlin.coroutines");
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class IC(val s: Any)
|
||||
|
||||
class Test1() {
|
||||
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(ss: IC): IC = IC(ss.s)
|
||||
|
||||
suspend fun <T> quz(t: T): T = t
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(qux(quz(IC("OK"))))
|
||||
}
|
||||
|
||||
suspend fun test(): Any = bar().s
|
||||
}
|
||||
|
||||
|
||||
class Test2 {
|
||||
|
||||
suspend fun foo(value: IC): IC {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(s: String): IC = IC(s)
|
||||
|
||||
suspend fun quz(): String = "OK"
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(qux(quz()))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
class Test3 {
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(IC("OK"))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
var result: Any = "FAIL"
|
||||
builder {
|
||||
result = Test1().test()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 1 $result"
|
||||
|
||||
result = "FAIL2"
|
||||
|
||||
builder {
|
||||
result = Test2().test()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 2 $result"
|
||||
|
||||
result = "FAIL 3"
|
||||
|
||||
builder {
|
||||
result = Test3().test()
|
||||
}
|
||||
|
||||
return result as String
|
||||
}
|
||||
Vendored
+100
@@ -0,0 +1,100 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class I0(val x: Any)
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class IC(val s: I0)
|
||||
|
||||
class Test1() {
|
||||
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(ss: IC): IC = IC(ss.s)
|
||||
|
||||
suspend fun <T> quz(t: T): T = t
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(qux(quz(IC(I0("OK")))))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s.x
|
||||
}
|
||||
|
||||
|
||||
class Test2 {
|
||||
|
||||
suspend fun foo(value: IC): IC {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(s: String): IC = IC(I0(s))
|
||||
|
||||
suspend fun quz(): String = "OK"
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(qux(quz()))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s.x
|
||||
}
|
||||
|
||||
class Test3 {
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(IC(I0("OK")))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s.x
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
var result: Any = "FAIL"
|
||||
builder {
|
||||
result = Test1().test()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 1 $result"
|
||||
|
||||
result = "FAIL2"
|
||||
|
||||
builder {
|
||||
result = Test2().test()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 2 $result"
|
||||
|
||||
result = "FAIL 3"
|
||||
|
||||
builder {
|
||||
result = Test3().test()
|
||||
}
|
||||
|
||||
return result as String
|
||||
}
|
||||
Vendored
+103
@@ -0,0 +1,103 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class I0(val x: Int)
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class IC(val s: I0)
|
||||
|
||||
class Test1() {
|
||||
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(ss: IC): IC = IC(ss.s)
|
||||
|
||||
suspend fun <T> quz(t: T): T = t
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(qux(quz(IC(I0(42)))))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s.x
|
||||
}
|
||||
|
||||
|
||||
class Test2 {
|
||||
|
||||
suspend fun foo(value: IC): IC {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(s: Int): IC = IC(I0(s))
|
||||
|
||||
suspend fun quz() = 42
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(qux(quz()))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s.x
|
||||
}
|
||||
|
||||
class Test3 {
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(IC(I0(42)))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s.x
|
||||
}
|
||||
|
||||
fun Int.toBoxResult() =
|
||||
if (this == 42) "OK" else toString()
|
||||
|
||||
fun box(): String {
|
||||
|
||||
var result: Any = "FAIL"
|
||||
builder {
|
||||
result = Test1().test().toBoxResult()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 1 $result"
|
||||
|
||||
result = "FAIL2"
|
||||
|
||||
builder {
|
||||
result = Test2().test().toBoxResult()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 2 $result"
|
||||
|
||||
result = "FAIL 3"
|
||||
|
||||
builder {
|
||||
result = Test3().test().toBoxResult()
|
||||
}
|
||||
|
||||
return result as String
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class IC(val s: Int)
|
||||
|
||||
class Test1() {
|
||||
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(ss: IC): IC = IC(ss.s)
|
||||
|
||||
suspend fun <T> quz(t: T): T = t
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(qux(quz(IC(42))))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
|
||||
class Test2 {
|
||||
|
||||
suspend fun foo(value: IC): IC {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(s: Int): IC = IC(s)
|
||||
|
||||
suspend fun quz(): Int = 42
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(qux(quz()))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
class Test3 {
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(IC(42))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
fun Int.toBoxResult() =
|
||||
if (this == 42) "OK" else toString()
|
||||
|
||||
fun box(): String {
|
||||
|
||||
var result: String = "FAIL"
|
||||
builder {
|
||||
result = Test1().test().toBoxResult()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 1 $result"
|
||||
|
||||
result = "FAIL2"
|
||||
|
||||
builder {
|
||||
result = Test2().test().toBoxResult()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 2 $result"
|
||||
|
||||
result = "FAIL 3"
|
||||
|
||||
builder {
|
||||
result = Test3().test().toBoxResult()
|
||||
}
|
||||
|
||||
return result as String
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class IC(val s: Long)
|
||||
|
||||
class Test1() {
|
||||
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(ss: IC): IC = IC(ss.s)
|
||||
|
||||
suspend fun <T> quz(t: T): T = t
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(qux(quz(IC(42L))))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
|
||||
class Test2 {
|
||||
|
||||
suspend fun foo(value: IC): IC {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(s: Long): IC = IC(s)
|
||||
|
||||
suspend fun quz() = 42L
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(qux(quz()))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
class Test3 {
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(IC(42L))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
fun Long.toBoxResult() =
|
||||
if (this == 42L) "OK" else toString()
|
||||
|
||||
fun box(): String {
|
||||
|
||||
var result: String = "FAIL"
|
||||
builder {
|
||||
result = Test1().test().toBoxResult()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 1 $result"
|
||||
|
||||
result = "FAIL2"
|
||||
|
||||
builder {
|
||||
result = Test2().test().toBoxResult()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 2 $result"
|
||||
|
||||
result = "FAIL 3"
|
||||
|
||||
builder {
|
||||
result = Test3().test().toBoxResult()
|
||||
}
|
||||
|
||||
return result as String
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class IC(val s: Any?)
|
||||
|
||||
class Test1() {
|
||||
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(ss: IC): IC = IC(ss.s)
|
||||
|
||||
suspend fun <T> quz(t: T): T = t
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(qux(quz(IC("OK"))))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
|
||||
class Test2 {
|
||||
|
||||
suspend fun foo(value: IC): IC {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(s: String): IC = IC(s)
|
||||
|
||||
suspend fun quz(): String = "OK"
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(qux(quz()))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
class Test3 {
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return foo(IC("OK"))
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
var result: Any? = "FAIL"
|
||||
builder {
|
||||
result = Test1().test()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 1 $result"
|
||||
|
||||
result = "FAIL2"
|
||||
|
||||
builder {
|
||||
result = Test2().test()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 2 $result"
|
||||
|
||||
result = "FAIL 3"
|
||||
|
||||
builder {
|
||||
result = Test3().test()
|
||||
}
|
||||
|
||||
return result as String
|
||||
}
|
||||
Vendored
+103
@@ -0,0 +1,103 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class IC(val s: String)
|
||||
|
||||
class Test1() {
|
||||
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(ss: IC): IC = IC(ss.s)
|
||||
|
||||
suspend fun <T> quz(t: T): T = t
|
||||
|
||||
suspend fun bar(): IC {
|
||||
run {
|
||||
return foo(qux(quz(IC("OK"))))
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
|
||||
class Test2 {
|
||||
|
||||
suspend fun foo(value: IC): IC {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(s: String): IC = IC(s)
|
||||
|
||||
suspend fun quz(): String = "OK"
|
||||
|
||||
suspend fun bar(): IC {
|
||||
run {
|
||||
return foo(qux(quz()))
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
class Test3 {
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun bar(): IC {
|
||||
run {
|
||||
return foo(IC("OK"))
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
var result = "FAIL"
|
||||
builder {
|
||||
result = Test1().test()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 1 $result"
|
||||
|
||||
result = "FAIL2"
|
||||
|
||||
builder {
|
||||
result = Test2().test()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 2 $result"
|
||||
|
||||
result = "FAIL 3"
|
||||
|
||||
builder {
|
||||
result = Test3().test()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class IC(val s: String)
|
||||
|
||||
fun suspendFunId(block: suspend () -> IC) = block
|
||||
|
||||
class Test1() {
|
||||
|
||||
suspend fun <T> foo(value: T): T {
|
||||
return suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(value)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun qux(ss: IC): IC = IC(ss.s)
|
||||
|
||||
suspend fun <T> quz(t: T): T = t
|
||||
|
||||
suspend fun bar(): IC {
|
||||
return suspendFunId { foo(qux(quz(IC("OK")))) }()
|
||||
}
|
||||
|
||||
suspend fun test() = bar().s
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
var result = "FAIL"
|
||||
builder {
|
||||
result = Test1().test()
|
||||
}
|
||||
|
||||
if (result != "OK") return "FAIL 1 $result"
|
||||
|
||||
return result
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
inline class ICInt(val x: Int) // unbox-impl in generated 'equals'
|
||||
|
||||
suspend fun suspendICInt(): ICInt = ICInt(1) // box-impl
|
||||
suspend fun suspendAny(): Any = ICInt(1) // box-impl
|
||||
suspend fun <T> suspendGeneric(x: T): T = x
|
||||
|
||||
fun useICInt(x: ICInt) {}
|
||||
fun useAny(x: Any) {}
|
||||
|
||||
suspend fun test() {
|
||||
useICInt(suspendICInt()) // unbox-impl
|
||||
useICInt(suspendGeneric(ICInt(1))) // box-impl, unbox-impl
|
||||
useAny(suspendAny())
|
||||
useAny(suspendICInt())
|
||||
}
|
||||
|
||||
// 3 INVOKESTATIC ICInt\.box-impl
|
||||
// 3 INVOKEVIRTUAL ICInt\.unbox-impl
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
inline class ICAny(val x: Any)
|
||||
|
||||
suspend fun suspendICAny(): ICAny = ICAny("")
|
||||
suspend fun suspendAny(): Any = ICAny("")
|
||||
suspend fun <T> suspendGeneric(x: T): T = x
|
||||
|
||||
fun useICAny(x: ICAny) {}
|
||||
fun useAny(x: Any) {}
|
||||
|
||||
suspend fun test() {
|
||||
useICAny(suspendICAny())
|
||||
useICAny(suspendGeneric(ICAny("")))
|
||||
useAny(suspendAny())
|
||||
useAny(suspendICAny())
|
||||
}
|
||||
|
||||
// -- 1 in 'suspendAny(): Any = ICAny("")'
|
||||
// -- 1 in 'useAny(suspendICAny())'
|
||||
// -- 1 in 'suspendGeneric(ICAny(""))'
|
||||
// 3 INVOKESTATIC ICAny\.box-impl
|
||||
|
||||
// -- 1 in 'useICAny(suspendGeneric(ICAny("")))
|
||||
// -- 1 in 'equals-impl' for ICAny
|
||||
// 2 INVOKEVIRTUAL ICAny\.unbox-impl
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
inline class IC0(val x: Any) // IC0.unbox-impl in generated 'equals'
|
||||
inline class IC1(val x: IC0) // IC1.unbox-impl in generated 'equals'
|
||||
|
||||
suspend fun suspendIC(): IC1 = IC1(IC0(""))
|
||||
suspend fun suspendAny(): Any = IC1(IC0("")) // IC1.box-impl
|
||||
suspend fun <T> suspendGeneric(x: T): T = x
|
||||
|
||||
fun useIC(x: IC1) {}
|
||||
fun useAny(x: Any) {}
|
||||
|
||||
suspend fun test() {
|
||||
useIC(suspendIC())
|
||||
useIC(suspendGeneric(IC1(IC0("")))) // IC1.box-impl, IC1.unbox-impl
|
||||
useAny(suspendAny())
|
||||
useAny(suspendIC()) // IC1.box-impl
|
||||
}
|
||||
|
||||
// 0 INVOKESTATIC IC0\.box-impl
|
||||
// 3 INVOKESTATIC IC1\.box-impl
|
||||
|
||||
// 1 INVOKEVIRTUAL IC0\.unbox-impl
|
||||
// 2 INVOKEVIRTUAL IC1\.unbox-impl
|
||||
+80
@@ -7733,6 +7733,86 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("bridgeGenerationCrossinline.kt")
|
||||
public void testBridgeGenerationCrossinline_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt", "kotlin.coroutines.experimental");
|
||||
|
||||
@@ -1472,6 +1472,34 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InlineClasses extends AbstractBytecodeTextTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInlineClasses() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassBoxingInSuspendFunReturn_Primitive.kt")
|
||||
public void testInlineClassBoxingInSuspendFunReturn_Primitive() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses/inlineClassBoxingInSuspendFunReturn_Primitive.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineClassBoxingInSuspendFunReturn_Any.kt")
|
||||
public void testNoInlineClassBoxingInSuspendFunReturn_Any() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses/noInlineClassBoxingInSuspendFunReturn_Any.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineClassBoxingInSuspendFunReturn_InlineAny.kt")
|
||||
public void testNoInlineClassBoxingInSuspendFunReturn_InlineAny() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses/noInlineClassBoxingInSuspendFunReturn_InlineAny.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+80
@@ -7733,6 +7733,86 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("bridgeGenerationCrossinline.kt")
|
||||
public void testBridgeGenerationCrossinline_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt", "kotlin.coroutines.experimental");
|
||||
|
||||
+40
@@ -7023,6 +7023,46 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("bridgeGenerationCrossinline.kt")
|
||||
public void testBridgeGenerationCrossinline_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt", "kotlin.coroutines");
|
||||
|
||||
+28
@@ -1477,6 +1477,34 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InlineClasses extends AbstractIrBytecodeTextTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInlineClasses() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassBoxingInSuspendFunReturn_Primitive.kt")
|
||||
public void testInlineClassBoxingInSuspendFunReturn_Primitive() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses/inlineClassBoxingInSuspendFunReturn_Primitive.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineClassBoxingInSuspendFunReturn_Any.kt")
|
||||
public void testNoInlineClassBoxingInSuspendFunReturn_Any() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses/noInlineClassBoxingInSuspendFunReturn_Any.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineClassBoxingInSuspendFunReturn_InlineAny.kt")
|
||||
public void testNoInlineClassBoxingInSuspendFunReturn_InlineAny() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses/noInlineClassBoxingInSuspendFunReturn_InlineAny.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Generated
+40
@@ -5953,6 +5953,46 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("bridgeGenerationCrossinline.kt")
|
||||
public void testBridgeGenerationCrossinline_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt", "kotlin.coroutines");
|
||||
|
||||
+40
@@ -5953,6 +5953,46 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("bridgeGenerationCrossinline.kt")
|
||||
public void testBridgeGenerationCrossinline_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt", "kotlin.coroutines");
|
||||
|
||||
Reference in New Issue
Block a user