IR: copy context receiver parameters count in FakeOverrideCopier

#KT-63430 Fixed
This commit is contained in:
Alexander Udalov
2023-11-13 16:08:00 +01:00
committed by Space Team
parent fc64e30829
commit 54705e5afc
10 changed files with 74 additions and 0 deletions
@@ -18351,6 +18351,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt58476.kt");
}
@Test
@TestMetadata("kt63430.kt")
public void testKt63430() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt63430.kt");
}
@Test
@TestMetadata("overload.kt")
public void testOverload() throws Exception {
@@ -18351,6 +18351,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt58476.kt");
}
@Test
@TestMetadata("kt63430.kt")
public void testKt63430() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt63430.kt");
}
@Test
@TestMetadata("overload.kt")
public void testOverload() throws Exception {
@@ -18280,6 +18280,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt58476.kt");
}
@Test
@TestMetadata("kt63430.kt")
public void testKt63430() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt63430.kt");
}
@Test
@TestMetadata("overload.kt")
public void testOverload() throws Exception {
@@ -18280,6 +18280,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt58476.kt");
}
@Test
@TestMetadata("kt63430.kt")
public void testKt63430() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt63430.kt");
}
@Test
@TestMetadata("overload.kt")
public void testOverload() throws Exception {
@@ -18280,6 +18280,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt58476.kt");
}
@Test
@TestMetadata("kt63430.kt")
public void testKt63430() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt63430.kt");
}
@Test
@TestMetadata("overload.kt")
public void testOverload() throws Exception {
@@ -35,6 +35,7 @@ class FakeOverrideCopier(
isInfix = declaration.isInfix,
isExternal = declaration.isExternal,
).apply {
contextReceiverParametersCount = declaration.contextReceiverParametersCount
transformAnnotations(declaration)
copyTypeParametersFrom(declaration)
typeRemapper.withinScope(this) {
@@ -0,0 +1,26 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
abstract class A {
context(C)
fun P.foo(): String = result
}
class B : A() {
val p = P()
context(C)
fun test(): String =
p.run {
foo()
}
}
class P
class C(val result: String)
fun box(): String =
with(C("OK")) {
B().test()
}
@@ -18280,6 +18280,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt58476.kt");
}
@Test
@TestMetadata("kt63430.kt")
public void testKt63430() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt63430.kt");
}
@Test
@TestMetadata("overload.kt")
public void testOverload() throws Exception {
@@ -18280,6 +18280,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt58476.kt");
}
@Test
@TestMetadata("kt63430.kt")
public void testKt63430() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt63430.kt");
}
@Test
@TestMetadata("overload.kt")
public void testOverload() throws Exception {
@@ -15169,6 +15169,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt58476.kt");
}
@TestMetadata("kt63430.kt")
public void testKt63430() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt63430.kt");
}
@TestMetadata("overload.kt")
public void testOverload() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/overload.kt");