Support KClass.companionObject and companionObjectInstance
#KT-7636 Fixed
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
import kotlin.reflect.*
|
||||
import kotlin.test.*
|
||||
|
||||
class A {
|
||||
companion object C
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val obj = A::class.companionObject
|
||||
assertNotNull(obj)
|
||||
assertEquals("C", obj!!.simpleName)
|
||||
|
||||
assertEquals(A.C, A::class.companionObjectInstance)
|
||||
assertEquals(A.C, obj.objectInstance)
|
||||
|
||||
assertNull(A.C::class.companionObject)
|
||||
assertNull(A.C::class.companionObjectInstance)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -3012,6 +3012,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("companionObject.kt")
|
||||
public void testCompanionObject() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/classes/companionObject.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultType.kt")
|
||||
public void testDefaultType() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/classes/defaultType.kt");
|
||||
|
||||
Reference in New Issue
Block a user