JVM: add tests for companion object accessor generation

This commit is contained in:
Dmitry Petrov
2020-01-15 12:13:16 +03:00
parent 3d85e5da5f
commit 6bbfb2ffe9
4 changed files with 62 additions and 0 deletions
@@ -0,0 +1,22 @@
// !LANGUAGE: +ProperVisibilityForCompanionObjectInstanceField
// IGNORE_BACKEND: JVM_IR
// ^ TODO implement ProperVisibilityForCompanionObjectInstanceField feature support in JMV_IR
// FILE: Base.kt
package a
open class Base {
protected companion object {
fun foo() = 1
}
}
// FILE: Host.kt
import a.*
class Host : Base() {
fun test() = { foo() }
}
// @Host.class:
// 1 synthetic access\$
@@ -0,0 +1,20 @@
// !LANGUAGE: -ProperVisibilityForCompanionObjectInstanceField
// FILE: Base.kt
package a
open class Base {
protected companion object {
fun foo() = 1
}
}
// FILE: Host.kt
import a.*
class Host : Base() {
fun test() = { foo() }
}
// @Host.class:
// 0 synthetic access\$
@@ -930,6 +930,16 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
public void testPrivateCompanionObjectAccessors_before() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/companion/privateCompanionObjectAccessors_before.kt");
}
@TestMetadata("protectedCompanionObjectAccessors_after.kt")
public void testProtectedCompanionObjectAccessors_after() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/companion/protectedCompanionObjectAccessors_after.kt");
}
@TestMetadata("protectedCompanionObjectAccessors_before.kt")
public void testProtectedCompanionObjectAccessors_before() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/companion/protectedCompanionObjectAccessors_before.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/conditions")
@@ -930,6 +930,16 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
public void testPrivateCompanionObjectAccessors_before() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/companion/privateCompanionObjectAccessors_before.kt");
}
@TestMetadata("protectedCompanionObjectAccessors_after.kt")
public void testProtectedCompanionObjectAccessors_after() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/companion/protectedCompanionObjectAccessors_after.kt");
}
@TestMetadata("protectedCompanionObjectAccessors_before.kt")
public void testProtectedCompanionObjectAccessors_before() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/companion/protectedCompanionObjectAccessors_before.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/conditions")