Support KParameter.kind: instance, extension receiver, or value

This commit is contained in:
Alexander Udalov
2015-08-20 16:27:09 -07:00
parent a73d02418d
commit d4825cf4f0
5 changed files with 48 additions and 3 deletions
@@ -0,0 +1,18 @@
import kotlin.reflect.*
import kotlin.reflect.KParameter.Kind.*
import kotlin.test.assertEquals
class A {
fun Int.foo(x: String) {}
inner class Inner(s: String) {}
}
fun box(): String {
val foo = A::class.memberExtensionFunctions.single()
assertEquals(listOf(INSTANCE, EXTENSION_RECEIVER, VALUE), foo.parameters.map { it.kind })
assertEquals(listOf(INSTANCE, VALUE), A::Inner.parameters.map { it.kind })
return "OK"
}
@@ -3597,6 +3597,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
doTestWithStdlib(fileName);
}
@TestMetadata("kinds.kt")
public void testKinds() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/parameters/kinds.kt");
doTestWithStdlib(fileName);
}
@TestMetadata("propertySetter.kt")
public void testPropertySetter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/parameters/propertySetter.kt");