KT-11960 Fix for data classes
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// Enable for JVM backend when KT-8120 gets fixed
|
||||
// TARGET_BACKEND: JS
|
||||
|
||||
fun box(): String {
|
||||
val capturedInConstructor = 1
|
||||
|
||||
data class A(var x: Int) {
|
||||
var y = 0
|
||||
|
||||
init {
|
||||
y += x + capturedInConstructor
|
||||
}
|
||||
}
|
||||
|
||||
val a = A(100).copy()
|
||||
if (a.y != 101) return "fail1a: ${a.y}"
|
||||
if (a.x != 100) return "fail1b: ${a.x}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -13015,6 +13015,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("localDataClass.kt")
|
||||
public void testLocalDataClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/localDataClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("superCallPrimary.kt")
|
||||
public void testSuperCallPrimary() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/superCallPrimary.kt");
|
||||
|
||||
Reference in New Issue
Block a user