KT-27706: Dispatch receiver type for constructor accessor is Object
This commit is contained in:
@@ -884,7 +884,9 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
|
||||
boolean accessorIsConstructor = accessorDescriptor instanceof AccessorForConstructorDescriptor;
|
||||
|
||||
ReceiverParameterDescriptor dispatchReceiver = functionDescriptor.getDispatchReceiverParameter();
|
||||
Type dispatchReceiverType = dispatchReceiver != null ? typeMapper.mapType(dispatchReceiver.getType()) : AsmTypes.OBJECT_TYPE;
|
||||
Type dispatchReceiverType = dispatchReceiver != null && !accessorIsConstructor
|
||||
? typeMapper.mapType(dispatchReceiver.getType())
|
||||
: AsmTypes.OBJECT_TYPE;
|
||||
|
||||
int accessorParam = (hasDispatchReceiver && !accessorIsConstructor) ? 1 : 0;
|
||||
int reg = hasDispatchReceiver ? dispatchReceiverType.getSize() : 0;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
inline class Z(val x: Int) {
|
||||
inner class Inner(val z: Z) {
|
||||
val xx = x
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val zi = Z(42).Inner(Z(100))
|
||||
if (zi.xx != 42) throw AssertionError()
|
||||
if (zi.z.x != 100) throw AssertionError()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+5
@@ -12060,6 +12060,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt27705.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt27706.kt")
|
||||
public void testKt27706() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt27706.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt")
|
||||
public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt");
|
||||
|
||||
+5
@@ -12060,6 +12060,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt27705.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt27706.kt")
|
||||
public void testKt27706() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt27706.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt")
|
||||
public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt");
|
||||
|
||||
+5
@@ -12065,6 +12065,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt27705.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt27706.kt")
|
||||
public void testKt27706() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt27706.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt")
|
||||
public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt");
|
||||
|
||||
+5
@@ -10460,6 +10460,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt27705.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt27706.kt")
|
||||
public void testKt27706() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt27706.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt")
|
||||
public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt");
|
||||
|
||||
+5
@@ -11505,6 +11505,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt27705.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt27706.kt")
|
||||
public void testKt27706() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt27706.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt")
|
||||
public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt");
|
||||
|
||||
Reference in New Issue
Block a user