Use original method signature to call accessor for hidden constructor

#KT-28855 Fixed Target versions 1.3.30
This commit is contained in:
Dmitry Petrov
2018-12-21 11:35:28 +03:00
parent 10f0a2f660
commit 2f6c4a0472
7 changed files with 40 additions and 1 deletions
@@ -2271,7 +2271,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
// Constructors with inline class type value parameters should always be called using an accessor.
// NB this will require accessors even if the constructor itself is in a different module.
return new AccessorForConstructorDescriptor(
(ClassConstructorDescriptor) descriptor,
(ClassConstructorDescriptor) descriptor.getOriginal(),
descriptor.getContainingDeclaration(),
getSuperCallTarget(resolvedCall.getCall()),
AccessorKind.NORMAL
@@ -0,0 +1,14 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
class C<T>(val x: T, vararg ys: UInt) {
val y0 = ys[0]
}
fun box(): String {
val c = C("a", 42u)
if (c.y0 != 42u) throw AssertionError()
return "OK"
}
@@ -12729,6 +12729,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/innerClassConstructor.kt");
}
@TestMetadata("kt28855.kt")
public void testKt28855() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt");
}
@TestMetadata("primaryConstructor.kt")
public void testPrimaryConstructor() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/primaryConstructor.kt");
@@ -12729,6 +12729,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/innerClassConstructor.kt");
}
@TestMetadata("kt28855.kt")
public void testKt28855() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt");
}
@TestMetadata("primaryConstructor.kt")
public void testPrimaryConstructor() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/primaryConstructor.kt");
@@ -12734,6 +12734,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/innerClassConstructor.kt");
}
@TestMetadata("kt28855.kt")
public void testKt28855() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt");
}
@TestMetadata("primaryConstructor.kt")
public void testPrimaryConstructor() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/primaryConstructor.kt");
@@ -10309,6 +10309,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/innerClassConstructor.kt");
}
@TestMetadata("kt28855.kt")
public void testKt28855() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt");
}
@TestMetadata("primaryConstructor.kt")
public void testPrimaryConstructor() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/primaryConstructor.kt");
@@ -11354,6 +11354,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/innerClassConstructor.kt");
}
@TestMetadata("kt28855.kt")
public void testKt28855() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt");
}
@TestMetadata("primaryConstructor.kt")
public void testPrimaryConstructor() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/primaryConstructor.kt");