diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 64cecfab7c5..05d4f63a0c1 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -6713,6 +6713,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/kt35967.kt"); } + @TestMetadata("kt42028.kt") + public void testKt42028() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt42028.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt index 34e6b0f09e9..4f6b3eeba70 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt @@ -135,9 +135,6 @@ private class AddContinuationLowering(private val context: JvmBackendContext) : "Inconsistency between callable reference to suspend lambda and the corresponding continuation" } +irCall(constructor.symbol).apply { - for (typeParameter in constructor.parentAsClass.typeParameters) { - putTypeArgument(typeParameter.index, expression.getTypeArgument(typeParameter.index)) - } expressionArguments.forEachIndexed { index, argument -> putValueArgument(index, argument) } @@ -166,7 +163,6 @@ private class AddContinuationLowering(private val context: JvmBackendContext) : if (insideInlineFunction) DescriptorVisibilities.PUBLIC else JavaDescriptorVisibilities.PACKAGE_VISIBILITY ).apply { copyAttributes(info.reference) - copyTypeParametersFrom(info.function) val functionNClass = context.ir.symbols.getJvmFunctionClass(info.arity + 1) superTypes += IrSimpleTypeImpl( diff --git a/compiler/testData/codegen/box/coroutines/kt42028.kt b/compiler/testData/codegen/box/coroutines/kt42028.kt new file mode 100644 index 00000000000..7e0280bd241 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/kt42028.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME +// WITH_COROUTINES + +import kotlin.coroutines.* +import helpers.* + +interface I { + suspend fun foo(g: suspend String.() -> Unit) +} + +fun builder0(f: suspend () -> Unit) { + f.startCoroutine(EmptyContinuation) +} + +fun builder(f: suspend I.() -> T) { + builder0 { + f(object : I { + override suspend fun foo(g: suspend String.() -> Unit) { + g("OK") + "Force non-tail call".length + } + }) + } +} + +fun box(): String { + var result = "Fail" + builder { + foo { + result = this + } + } + return result +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 8424b24f480..95310bab86d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -6968,6 +6968,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/kt35967.kt"); } + @TestMetadata("kt42028.kt") + public void testKt42028() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt42028.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines.experimental"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index a6dfc1fece1..0cc4e3e6a9d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -6968,6 +6968,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/kt35967.kt"); } + @TestMetadata("kt42028.kt") + public void testKt42028() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt42028.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines.experimental"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index ee5f9db79c3..1d4b532a073 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -6713,6 +6713,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/kt35967.kt"); } + @TestMetadata("kt42028.kt") + public void testKt42028() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt42028.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines"); diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitution.kt b/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitution.kt index 1073e88083a..b5e75beb208 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitution.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitution.kt @@ -88,7 +88,7 @@ class IndexedParametersSubstitution( ) : TypeSubstitution() { init { assert(parameters.size <= arguments.size) { - "Number of arguments should not be less then number of parameters, but: parameters=${parameters.size}, args=${arguments.size}" + "Number of arguments should not be less than number of parameters, but: parameters=${parameters.size}, args=${arguments.size}" } } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 56f07d8abd2..ea5b66d7264 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -5583,6 +5583,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/kt35967.kt"); } + @TestMetadata("kt42028.kt") + public void testKt42028() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt42028.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index af0eb861f41..6f75281184d 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -5583,6 +5583,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/kt35967.kt"); } + @TestMetadata("kt42028.kt") + public void testKt42028() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt42028.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 49c89a64aa2..dc253cb5a9e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -5583,6 +5583,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/kt35967.kt"); } + @TestMetadata("kt42028.kt") + public void testKt42028() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt42028.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines");