[IR BE] Remap dispatch receiver for inner ctor too
- do not forget to add into mapping dispatch receiver - fix KT-40686 (at least part of it) - add test
This commit is contained in:
Generated
+5
@@ -15337,6 +15337,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerWithDefaultInner.kt")
|
||||||
|
public void testInnerWithDefaultInner() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultInner.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt3132.kt")
|
@TestMetadata("kt3132.kt")
|
||||||
public void testKt3132() throws Exception {
|
public void testKt3132() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
||||||
|
|||||||
+10
-2
@@ -97,10 +97,18 @@ private fun InnerClassesSupport.primaryConstructorParameterMap(originalConstruct
|
|||||||
|
|
||||||
val loweredConstructor = getInnerClassConstructorWithOuterThisParameter(originalConstructor)
|
val loweredConstructor = getInnerClassConstructorWithOuterThisParameter(originalConstructor)
|
||||||
|
|
||||||
originalConstructor.valueParameters.forEach { old ->
|
var index = 0
|
||||||
oldConstructorParameterToNew[old] = loweredConstructor.valueParameters[old.index + 1]
|
|
||||||
|
originalConstructor.dispatchReceiverParameter?.let {
|
||||||
|
oldConstructorParameterToNew[it] = loweredConstructor.valueParameters[index++]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
originalConstructor.valueParameters.forEach { old ->
|
||||||
|
oldConstructorParameterToNew[old] = loweredConstructor.valueParameters[index++]
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(loweredConstructor.valueParameters.size == index)
|
||||||
|
|
||||||
return oldConstructorParameterToNew
|
return oldConstructorParameterToNew
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
// KT-40686
|
||||||
|
|
||||||
|
|
||||||
|
class Outer(val o: String, val oo: String) {
|
||||||
|
inner class InnerArg(val i: String) {
|
||||||
|
val result: String get() = o + i
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class InnerParam(val i: InnerArg = InnerArg("B")) {
|
||||||
|
fun foo() = i.result + oo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val o = Outer("A", "C")
|
||||||
|
val i = o.InnerParam()
|
||||||
|
|
||||||
|
val rr = i.foo()
|
||||||
|
if (rr != "ABC") return "FAIL: $rr"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+5
@@ -16737,6 +16737,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerWithDefaultInner.kt")
|
||||||
|
public void testInnerWithDefaultInner() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultInner.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt3132.kt")
|
@TestMetadata("kt3132.kt")
|
||||||
public void testKt3132() throws Exception {
|
public void testKt3132() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
||||||
|
|||||||
+5
@@ -16737,6 +16737,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerWithDefaultInner.kt")
|
||||||
|
public void testInnerWithDefaultInner() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultInner.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt3132.kt")
|
@TestMetadata("kt3132.kt")
|
||||||
public void testKt3132() throws Exception {
|
public void testKt3132() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
||||||
|
|||||||
+5
@@ -15337,6 +15337,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerWithDefaultInner.kt")
|
||||||
|
public void testInnerWithDefaultInner() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultInner.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt3132.kt")
|
@TestMetadata("kt3132.kt")
|
||||||
public void testKt3132() throws Exception {
|
public void testKt3132() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
||||||
|
|||||||
Generated
+5
@@ -13302,6 +13302,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerWithDefaultInner.kt")
|
||||||
|
public void testInnerWithDefaultInner() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultInner.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt3132.kt")
|
@TestMetadata("kt3132.kt")
|
||||||
public void testKt3132() throws Exception {
|
public void testKt3132() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
||||||
|
|||||||
Generated
+5
@@ -13302,6 +13302,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerWithDefaultInner.kt")
|
||||||
|
public void testInnerWithDefaultInner() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultInner.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt3132.kt")
|
@TestMetadata("kt3132.kt")
|
||||||
public void testKt3132() throws Exception {
|
public void testKt3132() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
||||||
|
|||||||
+5
@@ -13367,6 +13367,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerWithDefaultInner.kt")
|
||||||
|
public void testInnerWithDefaultInner() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultInner.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt3132.kt")
|
@TestMetadata("kt3132.kt")
|
||||||
public void testKt3132() throws Exception {
|
public void testKt3132() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
||||||
|
|||||||
Generated
+5
@@ -7632,6 +7632,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultArgument.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerWithDefaultInner.kt")
|
||||||
|
public void testInnerWithDefaultInner() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/innerWithDefaultInner.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt3132.kt")
|
@TestMetadata("kt3132.kt")
|
||||||
public void testKt3132() throws Exception {
|
public void testKt3132() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
runTest("compiler/testData/codegen/box/innerNested/kt3132.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user