Box inline class return value in lambdas (including suspend lambdas)

This commit is contained in:
Dmitry Petrov
2020-04-08 12:28:17 +03:00
parent 59b72b3156
commit 9615b20e5d
22 changed files with 691 additions and 18 deletions
@@ -26,10 +26,7 @@ import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor
import org.jetbrains.kotlin.descriptors.impl.LocalVariableAccessorDescriptor
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor
import org.jetbrains.kotlin.descriptors.impl.*
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature
import org.jetbrains.kotlin.load.java.JvmAbi
@@ -42,7 +39,10 @@ import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaPackageFragment
import org.jetbrains.kotlin.load.kotlin.*
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackageFragmentProvider.IncrementalMultifileClassPackageFragment
import org.jetbrains.kotlin.name.*
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.KtBinaryExpressionWithTypeRHS
import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.psi.KtFunctionLiteral
import org.jetbrains.kotlin.psi.KtLambdaExpression
import org.jetbrains.kotlin.psi.psiUtil.getOutermostParenthesizerOrThis
import org.jetbrains.kotlin.psi.psiUtil.getQualifiedExpressionForSelector
import org.jetbrains.kotlin.resolve.*
@@ -64,7 +64,6 @@ import org.jetbrains.kotlin.resolve.jvm.annotations.hasJvmDefaultAnnotation
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DescriptorWithContainerSource
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
import org.jetbrains.kotlin.types.*
@@ -379,6 +378,12 @@ class KotlinTypeMapper @JvmOverloads constructor(
return originalSuspendFunction.module.builtIns.nullableAnyType
}
// Lambdas, callable references, and function literals implicitly override corresponding generic method from a base class.
// NB we don't have suspend function literals so far, but we support it in back-end, just in case.
if (isFunctionLiteral(originalSuspendFunction) || isFunctionExpression(originalSuspendFunction)) {
return originalSuspendFunction.module.builtIns.nullableAnyType
}
// NB JVM view of a Kotlin function overrides JVM views of corresponding overridden functions
val originalOverridden = getAllOverriddenDeclarations(functionDescriptor).map {
it.unwrapInitialDescriptorForSuspendFunction().original
@@ -957,16 +962,9 @@ class KotlinTypeMapper @JvmOverloads constructor(
val returnType = descriptor.returnType!!
// Crude hack to determine whether it is an AnonymousFunctionDescriptor created for callable reference.
// Ideally, we should force return type boxing for all anonymous functions returning an inline class value
// (so that the result is boxed properly, since technically it is a covariant override of a corresponding generic 'invoke').
// But, unfortunately, we can't do so right now, because it'd break binary compatibility for lambdas returning 'Result'.
if (descriptor is AnonymousFunctionDescriptor) {
val source = descriptor.source
if (source is KotlinSourceElement && source.psi is KtCallableReferenceExpression && returnType.isInlineClassType()) {
return true
}
}
// 'invoke' methods for lambdas, function literals, and callable references
// implicitly override generic 'invoke' from a corresponding base class.
if ((isFunctionExpression(descriptor) || isFunctionLiteral(descriptor)) && returnType.isInlineClassType()) return true
return isJvmPrimitiveOrInlineClass(returnType) &&
getAllOverriddenDescriptors(descriptor).any { !isJvmPrimitiveOrInlineClass(it.returnType!!) }
@@ -7106,6 +7106,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("boxReturnValueOfSuspendFunctionReference.kt")
public void testBoxReturnValueOfSuspendFunctionReference() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendFunctionReference.kt");
}
@TestMetadata("boxReturnValueOfSuspendLambda.kt")
public void testBoxReturnValueOfSuspendLambda() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendLambda.kt");
}
@TestMetadata("boxUnboxInsideCoroutine.kt")
public void testBoxUnboxInsideCoroutine_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
@@ -12824,6 +12834,79 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inlineClasses/whenWithSubject.kt");
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoxReturnValueInLambda extends AbstractFirBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
}
public void testAllFilesPresentInBoxReturnValueInLambda() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("boxAny.kt")
public void testBoxAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxAny.kt");
}
@TestMetadata("boxFunLiteralAny.kt")
public void testBoxFunLiteralAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxFunLiteralAny.kt");
}
@TestMetadata("boxInt.kt")
public void testBoxInt() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxInt.kt");
}
@TestMetadata("boxNullableAny.kt")
public void testBoxNullableAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableAny.kt");
}
@TestMetadata("boxNullableAnyNull.kt")
public void testBoxNullableAnyNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableAnyNull.kt");
}
@TestMetadata("boxNullableInt.kt")
public void testBoxNullableInt() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableInt.kt");
}
@TestMetadata("boxNullableIntNull.kt")
public void testBoxNullableIntNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableIntNull.kt");
}
@TestMetadata("boxNullableString.kt")
public void testBoxNullableString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableString.kt");
}
@TestMetadata("boxNullableStringNull.kt")
public void testBoxNullableStringNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableStringNull.kt");
}
@TestMetadata("boxString.kt")
public void testBoxString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxString.kt");
}
@TestMetadata("kt27586_1.kt")
public void testKt27586_1() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/kt27586_1.kt");
}
@TestMetadata("kt27586_2.kt")
public void testKt27586_2() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/kt27586_2.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/boxReturnValueOnOverride")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -0,0 +1,27 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
inline class R(val x: Any)
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
suspend fun <T> call(fn: suspend () -> T) = fn()
fun useR(r: R) = if (r.x == "OK") "OK" else "fail: $r"
suspend fun ok() = R("OK")
fun box(): String {
var res: String = "fail"
builder {
res = useR(call(::ok))
}
return res
}
@@ -0,0 +1,25 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
inline class R(val x: Any)
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
suspend fun <T> call(fn: suspend () -> T) = fn()
fun useR(r: R) = if (r.x == "OK") "OK" else "fail: $r"
fun box(): String {
var res: String = "fail"
builder {
res = useR(call { R("OK") })
}
return res
}
@@ -0,0 +1,10 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
inline class X(val x: Any)
fun useX(x: X): String = x.x as String
fun <T> call(fn: () -> T) = fn()
fun box() = useX(call { X("OK") })
@@ -0,0 +1,10 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
inline class X(val x: Any)
fun useX(x: X): String = x.x as String
fun <T> call(fn: () -> T) = fn()
fun box() = useX(call(fun(): X { return X("OK") }))
@@ -0,0 +1,9 @@
// IGNORE_BACKEND: JVM_IR
inline class X(val x: Int)
fun useX(x: X): String = if (x.x == 42) "OK" else "fail: $x"
fun <T> call(fn: () -> T) = fn()
fun box() = useX(call { X(42) })
@@ -0,0 +1,10 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
inline class X(val x: Any?)
fun useX(x: X): String = x.x as String
fun <T> call(fn: () -> T) = fn()
fun box() = useX(call { X("OK") })
@@ -0,0 +1,10 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
inline class X(val x: Any?)
fun useX(x: X): String = if (x.x == null) "OK" else "fail: $x"
fun <T> call(fn: () -> T) = fn()
fun box() = useX(call { X(null) })
@@ -0,0 +1,9 @@
// IGNORE_BACKEND: JVM_IR
inline class X(val x: Int?)
fun useX(x: X): String = if (x.x == 42) "OK" else "fail: $x"
fun <T> call(fn: () -> T) = fn()
fun box() = useX(call { X(42) })
@@ -0,0 +1,9 @@
// IGNORE_BACKEND: JVM_IR
inline class X(val x: Int?)
fun useX(x: X): String = if (x.x == null) "OK" else "fail: $x"
fun <T> call(fn: () -> T) = fn()
fun box() = useX(call { X(null) })
@@ -0,0 +1,9 @@
// IGNORE_BACKEND: JVM_IR
inline class X(val x: String?)
fun useX(x: X): String = x.x ?: "fail: $x"
fun <T> call(fn: () -> T) = fn()
fun box() = useX(call { X("OK") })
@@ -0,0 +1,9 @@
// IGNORE_BACKEND: JVM_IR
inline class X(val x: String?)
fun useX(x: X): String = if (x.x == null) "OK" else "fail: $x"
fun <T> call(fn: () -> T) = fn()
fun box() = useX(call { X(null) })
@@ -0,0 +1,9 @@
// IGNORE_BACKEND: JVM_IR
inline class X(val x: String)
fun useX(x: X): String = x.x
fun <T> call(fn: () -> T) = fn()
fun box() = useX(call { X("OK") })
@@ -0,0 +1,16 @@
// WITH_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
fun f1(): () -> Result<String> {
return {
runCatching {
"OK"
}
}
}
fun box(): String {
val r = f1()()
return r.getOrNull() ?: "fail: $r"
}
@@ -0,0 +1,14 @@
// WITH_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
fun f1() = lazy {
runCatching {
"OK"
}
}
fun box(): String {
val r = f1().value
return r.getOrNull() ?: "fail: $r"
}
@@ -1,4 +1,5 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
// FILE: utils.kt
@@ -21,13 +22,13 @@ fun foo(): Boolean = true
fun labeled(): ULong? {
val u = ULong(0)
return run {
if (foo()) return@run u
if (foo()) return@run u // box
u // box
}
}
// @TestKt.class:
// 2 INVOKESTATIC ULong\.box
// 3 INVOKESTATIC ULong\.box
// 0 INVOKEVIRTUAL ULong.unbox
// 0 valueOf
@@ -7811,6 +7811,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("boxReturnValueOfSuspendFunctionReference.kt")
public void testBoxReturnValueOfSuspendFunctionReference() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendFunctionReference.kt");
}
@TestMetadata("boxReturnValueOfSuspendLambda.kt")
public void testBoxReturnValueOfSuspendLambda() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendLambda.kt");
}
@TestMetadata("boxUnboxInsideCoroutine.kt")
public void testBoxUnboxInsideCoroutine_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines.experimental");
@@ -14039,6 +14049,79 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/inlineClasses/whenWithSubject.kt");
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoxReturnValueInLambda extends AbstractBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInBoxReturnValueInLambda() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("boxAny.kt")
public void testBoxAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxAny.kt");
}
@TestMetadata("boxFunLiteralAny.kt")
public void testBoxFunLiteralAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxFunLiteralAny.kt");
}
@TestMetadata("boxInt.kt")
public void testBoxInt() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxInt.kt");
}
@TestMetadata("boxNullableAny.kt")
public void testBoxNullableAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableAny.kt");
}
@TestMetadata("boxNullableAnyNull.kt")
public void testBoxNullableAnyNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableAnyNull.kt");
}
@TestMetadata("boxNullableInt.kt")
public void testBoxNullableInt() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableInt.kt");
}
@TestMetadata("boxNullableIntNull.kt")
public void testBoxNullableIntNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableIntNull.kt");
}
@TestMetadata("boxNullableString.kt")
public void testBoxNullableString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableString.kt");
}
@TestMetadata("boxNullableStringNull.kt")
public void testBoxNullableStringNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableStringNull.kt");
}
@TestMetadata("boxString.kt")
public void testBoxString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxString.kt");
}
@TestMetadata("kt27586_1.kt")
public void testKt27586_1() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/kt27586_1.kt");
}
@TestMetadata("kt27586_2.kt")
public void testKt27586_2() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/kt27586_2.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/boxReturnValueOnOverride")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -7811,6 +7811,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("boxReturnValueOfSuspendFunctionReference.kt")
public void testBoxReturnValueOfSuspendFunctionReference() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendFunctionReference.kt");
}
@TestMetadata("boxReturnValueOfSuspendLambda.kt")
public void testBoxReturnValueOfSuspendLambda() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendLambda.kt");
}
@TestMetadata("boxUnboxInsideCoroutine.kt")
public void testBoxUnboxInsideCoroutine_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines.experimental");
@@ -14039,6 +14049,79 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/inlineClasses/whenWithSubject.kt");
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoxReturnValueInLambda extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInBoxReturnValueInLambda() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("boxAny.kt")
public void testBoxAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxAny.kt");
}
@TestMetadata("boxFunLiteralAny.kt")
public void testBoxFunLiteralAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxFunLiteralAny.kt");
}
@TestMetadata("boxInt.kt")
public void testBoxInt() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxInt.kt");
}
@TestMetadata("boxNullableAny.kt")
public void testBoxNullableAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableAny.kt");
}
@TestMetadata("boxNullableAnyNull.kt")
public void testBoxNullableAnyNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableAnyNull.kt");
}
@TestMetadata("boxNullableInt.kt")
public void testBoxNullableInt() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableInt.kt");
}
@TestMetadata("boxNullableIntNull.kt")
public void testBoxNullableIntNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableIntNull.kt");
}
@TestMetadata("boxNullableString.kt")
public void testBoxNullableString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableString.kt");
}
@TestMetadata("boxNullableStringNull.kt")
public void testBoxNullableStringNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableStringNull.kt");
}
@TestMetadata("boxString.kt")
public void testBoxString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxString.kt");
}
@TestMetadata("kt27586_1.kt")
public void testKt27586_1() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/kt27586_1.kt");
}
@TestMetadata("kt27586_2.kt")
public void testKt27586_2() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/kt27586_2.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/boxReturnValueOnOverride")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -7106,6 +7106,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("boxReturnValueOfSuspendFunctionReference.kt")
public void testBoxReturnValueOfSuspendFunctionReference() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendFunctionReference.kt");
}
@TestMetadata("boxReturnValueOfSuspendLambda.kt")
public void testBoxReturnValueOfSuspendLambda() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendLambda.kt");
}
@TestMetadata("boxUnboxInsideCoroutine.kt")
public void testBoxUnboxInsideCoroutine_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
@@ -12824,6 +12834,79 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/inlineClasses/whenWithSubject.kt");
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoxReturnValueInLambda extends AbstractIrBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public void testAllFilesPresentInBoxReturnValueInLambda() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("boxAny.kt")
public void testBoxAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxAny.kt");
}
@TestMetadata("boxFunLiteralAny.kt")
public void testBoxFunLiteralAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxFunLiteralAny.kt");
}
@TestMetadata("boxInt.kt")
public void testBoxInt() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxInt.kt");
}
@TestMetadata("boxNullableAny.kt")
public void testBoxNullableAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableAny.kt");
}
@TestMetadata("boxNullableAnyNull.kt")
public void testBoxNullableAnyNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableAnyNull.kt");
}
@TestMetadata("boxNullableInt.kt")
public void testBoxNullableInt() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableInt.kt");
}
@TestMetadata("boxNullableIntNull.kt")
public void testBoxNullableIntNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableIntNull.kt");
}
@TestMetadata("boxNullableString.kt")
public void testBoxNullableString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableString.kt");
}
@TestMetadata("boxNullableStringNull.kt")
public void testBoxNullableStringNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableStringNull.kt");
}
@TestMetadata("boxString.kt")
public void testBoxString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxString.kt");
}
@TestMetadata("kt27586_1.kt")
public void testKt27586_1() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/kt27586_1.kt");
}
@TestMetadata("kt27586_2.kt")
public void testKt27586_2() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/kt27586_2.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/boxReturnValueOnOverride")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -6036,6 +6036,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("boxReturnValueOfSuspendFunctionReference.kt")
public void testBoxReturnValueOfSuspendFunctionReference() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendFunctionReference.kt");
}
@TestMetadata("boxReturnValueOfSuspendLambda.kt")
public void testBoxReturnValueOfSuspendLambda() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendLambda.kt");
}
@TestMetadata("boxUnboxInsideCoroutine.kt")
public void testBoxUnboxInsideCoroutine_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
@@ -11039,6 +11049,79 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inlineClasses/whenWithSubject.kt");
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoxReturnValueInLambda extends AbstractIrJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInBoxReturnValueInLambda() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("boxAny.kt")
public void testBoxAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxAny.kt");
}
@TestMetadata("boxFunLiteralAny.kt")
public void testBoxFunLiteralAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxFunLiteralAny.kt");
}
@TestMetadata("boxInt.kt")
public void testBoxInt() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxInt.kt");
}
@TestMetadata("boxNullableAny.kt")
public void testBoxNullableAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableAny.kt");
}
@TestMetadata("boxNullableAnyNull.kt")
public void testBoxNullableAnyNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableAnyNull.kt");
}
@TestMetadata("boxNullableInt.kt")
public void testBoxNullableInt() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableInt.kt");
}
@TestMetadata("boxNullableIntNull.kt")
public void testBoxNullableIntNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableIntNull.kt");
}
@TestMetadata("boxNullableString.kt")
public void testBoxNullableString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableString.kt");
}
@TestMetadata("boxNullableStringNull.kt")
public void testBoxNullableStringNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableStringNull.kt");
}
@TestMetadata("boxString.kt")
public void testBoxString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxString.kt");
}
@TestMetadata("kt27586_1.kt")
public void testKt27586_1() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/kt27586_1.kt");
}
@TestMetadata("kt27586_2.kt")
public void testKt27586_2() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/kt27586_2.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/boxReturnValueOnOverride")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -6036,6 +6036,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@TestMetadata("boxReturnValueOfSuspendFunctionReference.kt")
public void testBoxReturnValueOfSuspendFunctionReference() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendFunctionReference.kt");
}
@TestMetadata("boxReturnValueOfSuspendLambda.kt")
public void testBoxReturnValueOfSuspendLambda() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendLambda.kt");
}
@TestMetadata("boxUnboxInsideCoroutine.kt")
public void testBoxUnboxInsideCoroutine_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
@@ -11104,6 +11114,79 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inlineClasses/whenWithSubject.kt");
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoxReturnValueInLambda extends AbstractJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
public void testAllFilesPresentInBoxReturnValueInLambda() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@TestMetadata("boxAny.kt")
public void testBoxAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxAny.kt");
}
@TestMetadata("boxFunLiteralAny.kt")
public void testBoxFunLiteralAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxFunLiteralAny.kt");
}
@TestMetadata("boxInt.kt")
public void testBoxInt() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxInt.kt");
}
@TestMetadata("boxNullableAny.kt")
public void testBoxNullableAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableAny.kt");
}
@TestMetadata("boxNullableAnyNull.kt")
public void testBoxNullableAnyNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableAnyNull.kt");
}
@TestMetadata("boxNullableInt.kt")
public void testBoxNullableInt() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableInt.kt");
}
@TestMetadata("boxNullableIntNull.kt")
public void testBoxNullableIntNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableIntNull.kt");
}
@TestMetadata("boxNullableString.kt")
public void testBoxNullableString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableString.kt");
}
@TestMetadata("boxNullableStringNull.kt")
public void testBoxNullableStringNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxNullableStringNull.kt");
}
@TestMetadata("boxString.kt")
public void testBoxString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/boxString.kt");
}
@TestMetadata("kt27586_1.kt")
public void testKt27586_1() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/kt27586_1.kt");
}
@TestMetadata("kt27586_2.kt")
public void testKt27586_2() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueInLambda/kt27586_2.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/boxReturnValueOnOverride")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)