Fix outer class mapping for closures in inline class
#KT-27030 #KT-27033
This commit is contained in:
@@ -406,7 +406,7 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
|
|||||||
return typeMapper.mapDefaultImpls(classDescriptor);
|
return typeMapper.mapDefaultImpls(classDescriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return typeMapper.mapType(classDescriptor);
|
return typeMapper.mapClass(classDescriptor);
|
||||||
}
|
}
|
||||||
else if (outermost instanceof MultifileClassFacadeContext || outermost instanceof DelegatingToPartContext) {
|
else if (outermost instanceof MultifileClassFacadeContext || outermost instanceof DelegatingToPartContext) {
|
||||||
Type implementationOwnerType = CodegenContextUtil.getImplementationOwnerClassType(outermost);
|
Type implementationOwnerType = CodegenContextUtil.getImplementationOwnerClassType(outermost);
|
||||||
|
|||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
// !LANGUAGE: +InlineClasses
|
||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
|
||||||
|
inline class R(private val r: Int) {
|
||||||
|
fun test() = { "OK" }()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() = R(0).test()
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
// !LANGUAGE: +InlineClasses
|
||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
|
||||||
|
inline class R(private val r: Int) {
|
||||||
|
fun test() =
|
||||||
|
object {
|
||||||
|
override fun toString() = "OK"
|
||||||
|
}.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() = R(0).test()
|
||||||
+10
@@ -11911,6 +11911,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lambdaInInlineClassFun.kt")
|
||||||
|
public void testLambdaInInlineClassFun() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/lambdaInInlineClassFun.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("objectInInlineClassFun.kt")
|
||||||
|
public void testObjectInInlineClassFun() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/objectInInlineClassFun.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("toPrivateCompanionFun.kt")
|
@TestMetadata("toPrivateCompanionFun.kt")
|
||||||
public void testToPrivateCompanionFun() throws Exception {
|
public void testToPrivateCompanionFun() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/toPrivateCompanionFun.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/toPrivateCompanionFun.kt");
|
||||||
|
|||||||
+10
@@ -11911,6 +11911,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lambdaInInlineClassFun.kt")
|
||||||
|
public void testLambdaInInlineClassFun() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/lambdaInInlineClassFun.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("objectInInlineClassFun.kt")
|
||||||
|
public void testObjectInInlineClassFun() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/objectInInlineClassFun.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("toPrivateCompanionFun.kt")
|
@TestMetadata("toPrivateCompanionFun.kt")
|
||||||
public void testToPrivateCompanionFun() throws Exception {
|
public void testToPrivateCompanionFun() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/toPrivateCompanionFun.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/toPrivateCompanionFun.kt");
|
||||||
|
|||||||
+10
@@ -11916,6 +11916,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lambdaInInlineClassFun.kt")
|
||||||
|
public void testLambdaInInlineClassFun() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/lambdaInInlineClassFun.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("objectInInlineClassFun.kt")
|
||||||
|
public void testObjectInInlineClassFun() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/objectInInlineClassFun.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("toPrivateCompanionFun.kt")
|
@TestMetadata("toPrivateCompanionFun.kt")
|
||||||
public void testToPrivateCompanionFun() throws Exception {
|
public void testToPrivateCompanionFun() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/toPrivateCompanionFun.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/toPrivateCompanionFun.kt");
|
||||||
|
|||||||
+10
@@ -10451,6 +10451,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lambdaInInlineClassFun.kt")
|
||||||
|
public void testLambdaInInlineClassFun() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/lambdaInInlineClassFun.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("objectInInlineClassFun.kt")
|
||||||
|
public void testObjectInInlineClassFun() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/objectInInlineClassFun.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("toPrivateCompanionFun.kt")
|
@TestMetadata("toPrivateCompanionFun.kt")
|
||||||
public void testToPrivateCompanionFun() throws Exception {
|
public void testToPrivateCompanionFun() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/toPrivateCompanionFun.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/toPrivateCompanionFun.kt");
|
||||||
|
|||||||
+10
@@ -11496,6 +11496,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lambdaInInlineClassFun.kt")
|
||||||
|
public void testLambdaInInlineClassFun() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/lambdaInInlineClassFun.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("objectInInlineClassFun.kt")
|
||||||
|
public void testObjectInInlineClassFun() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/objectInInlineClassFun.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("toPrivateCompanionFun.kt")
|
@TestMetadata("toPrivateCompanionFun.kt")
|
||||||
public void testToPrivateCompanionFun() throws Exception {
|
public void testToPrivateCompanionFun() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/toPrivateCompanionFun.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/contextsAndAccessors/toPrivateCompanionFun.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user