Minor: split test to access to companion and to nested object
This commit is contained in:
@@ -4,18 +4,14 @@ class A(val result: Int) {
|
|||||||
val prop = 2
|
val prop = 2
|
||||||
val C = 3
|
val C = 3
|
||||||
}
|
}
|
||||||
object B {
|
|
||||||
fun bar(): Int = 4
|
|
||||||
val prop = 5
|
|
||||||
}
|
|
||||||
object C {
|
object C {
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() : this(foo() + prop + B.bar() + B.prop + C)
|
constructor() : this(foo() + prop + C)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val result = A().result
|
val result = A().result
|
||||||
if (result != 15) return "fail: $result"
|
if (result != 6) return "fail: $result"
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// TODO enable for JS backend too when KT-6203 will be fixed
|
||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
|
class A(val result: Int) {
|
||||||
|
object B {
|
||||||
|
fun bar(): Int = 4
|
||||||
|
val prop = 5
|
||||||
|
}
|
||||||
|
object C {
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor() : this(B.bar() + B.prop)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val result = A().result
|
||||||
|
if (result != 9) return "fail: $result"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+6
@@ -6402,6 +6402,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("accessToNestedObject.kt")
|
||||||
|
public void testAccessToNestedObject() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/accessToNestedObject.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInSecondaryConstructors() throws Exception {
|
public void testAllFilesPresentInSecondaryConstructors() throws Exception {
|
||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/secondaryConstructors"), Pattern.compile("^(.+)\\.kt$"), true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/secondaryConstructors"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -31,6 +31,12 @@ import java.util.regex.Pattern;
|
|||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public class SecondaryConstructorTestGenerated extends AbstractSecondaryConstructorTest {
|
public class SecondaryConstructorTestGenerated extends AbstractSecondaryConstructorTest {
|
||||||
|
@TestMetadata("accessToNestedObject.kt")
|
||||||
|
public void ignoredAccessToNestedObject() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/accessToNestedObject.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("innerClasses.kt")
|
@TestMetadata("innerClasses.kt")
|
||||||
public void ignoredInnerClasses() throws Exception {
|
public void ignoredInnerClasses() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/innerClasses.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/innerClasses.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user