JVM: add tests for companion object accessor generation
This commit is contained in:
Vendored
+22
@@ -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\$
|
||||
Vendored
+20
@@ -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")
|
||||
|
||||
+10
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user