JVM IR: Fix compilation of nested inner classes
This commit is contained in:
committed by
Alexander Udalov
parent
02e78bcd76
commit
b02f0f0a25
Generated
+5
@@ -14478,6 +14478,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nestedInnerClass.kt")
|
||||||
|
public void testNestedInnerClass() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/nestedInnerClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedObjects.kt")
|
@TestMetadata("nestedObjects.kt")
|
||||||
public void testNestedObjects() throws Exception {
|
public void testNestedObjects() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
||||||
|
|||||||
+1
-1
@@ -141,7 +141,7 @@ class InnerClassesMemberBodyLowering(val context: BackendContext, private val in
|
|||||||
private fun IrBody.fixThisReference(irClass: IrClass, container: IrDeclaration) {
|
private fun IrBody.fixThisReference(irClass: IrClass, container: IrDeclaration) {
|
||||||
val enclosingFunction: IrDeclaration? = run {
|
val enclosingFunction: IrDeclaration? = run {
|
||||||
var current: IrDeclaration? = container
|
var current: IrDeclaration? = container
|
||||||
while (current != null && current !is IrFunction) {
|
while (current != null && current !is IrFunction && current !is IrClass) {
|
||||||
current = current.parent as? IrDeclaration
|
current = current.parent as? IrDeclaration
|
||||||
}
|
}
|
||||||
current
|
current
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
class A(val x: String) {
|
||||||
|
fun value(): String {
|
||||||
|
return object {
|
||||||
|
inner class Y {
|
||||||
|
val y = x
|
||||||
|
}
|
||||||
|
|
||||||
|
fun value() = Y().y
|
||||||
|
}.value()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String = A("OK").value()
|
||||||
+5
@@ -15703,6 +15703,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nestedInnerClass.kt")
|
||||||
|
public void testNestedInnerClass() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/nestedInnerClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedObjects.kt")
|
@TestMetadata("nestedObjects.kt")
|
||||||
public void testNestedObjects() throws Exception {
|
public void testNestedObjects() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
||||||
|
|||||||
+5
@@ -15703,6 +15703,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nestedInnerClass.kt")
|
||||||
|
public void testNestedInnerClass() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/nestedInnerClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedObjects.kt")
|
@TestMetadata("nestedObjects.kt")
|
||||||
public void testNestedObjects() throws Exception {
|
public void testNestedObjects() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
||||||
|
|||||||
+5
@@ -14478,6 +14478,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nestedInnerClass.kt")
|
||||||
|
public void testNestedInnerClass() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/nestedInnerClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedObjects.kt")
|
@TestMetadata("nestedObjects.kt")
|
||||||
public void testNestedObjects() throws Exception {
|
public void testNestedObjects() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
||||||
|
|||||||
Generated
+5
@@ -12533,6 +12533,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nestedInnerClass.kt")
|
||||||
|
public void testNestedInnerClass() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/nestedInnerClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedObjects.kt")
|
@TestMetadata("nestedObjects.kt")
|
||||||
public void testNestedObjects() throws Exception {
|
public void testNestedObjects() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
||||||
|
|||||||
Generated
+5
@@ -12533,6 +12533,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nestedInnerClass.kt")
|
||||||
|
public void testNestedInnerClass() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/nestedInnerClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedObjects.kt")
|
@TestMetadata("nestedObjects.kt")
|
||||||
public void testNestedObjects() throws Exception {
|
public void testNestedObjects() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
||||||
|
|||||||
+5
@@ -12598,6 +12598,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedInPackage.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nestedInnerClass.kt")
|
||||||
|
public void testNestedInnerClass() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/innerNested/nestedInnerClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedObjects.kt")
|
@TestMetadata("nestedObjects.kt")
|
||||||
public void testNestedObjects() throws Exception {
|
public void testNestedObjects() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
runTest("compiler/testData/codegen/box/innerNested/nestedObjects.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user