Fix translation of copy() fun in data class
Fix translation of copy() function in data class which has secondary constructor in JS BE. See KT-16717.
This commit is contained in:
committed by
Alexey Andreev
parent
b46205f60b
commit
466540399c
@@ -6520,6 +6520,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/dataClasses/copy/withGenericParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("withSecondaryConstructor.kt")
|
||||
public void testWithSecondaryConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/dataClasses/copy/withSecondaryConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/dataClasses/equals")
|
||||
|
||||
+2
-1
@@ -91,7 +91,8 @@ class JsDataClassGenerator extends DataClassMethodGenerator {
|
||||
}
|
||||
|
||||
ClassDescriptor classDescriptor = (ClassDescriptor) function.getContainingDeclaration();
|
||||
ClassConstructorDescriptor constructor = classDescriptor.getConstructors().iterator().next();
|
||||
ClassConstructorDescriptor constructor = classDescriptor.getUnsubstitutedPrimaryConstructor();
|
||||
assert constructor != null : "Data class should have primary constructor: " + classDescriptor;
|
||||
|
||||
JsExpression constructorRef = context.getInnerReference(constructor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user