Reflection: add KTypeParameter.toString
The test covers different type parameters with and without bounds, in case we decide to also output upper bounds in toString
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
interface Variance<A, in B, out C, D>
|
||||
class OneBound<T : Enum<T>>
|
||||
class SeveralBounds<T : Cloneable> where T : Enum<T>, T : Variance<String, Int?, Double?, Number>
|
||||
|
||||
fun box(): String {
|
||||
assertEquals("[A, in B, out C, D]", Variance::class.typeParameters.toString())
|
||||
assertEquals("[T]", OneBound::class.typeParameters.toString())
|
||||
assertEquals("[T]", SeveralBounds::class.typeParameters.toString())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -12573,6 +12573,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeParametersToString.kt")
|
||||
public void testTypeParametersToString() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/methodsFromAny/typeParametersToString.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeToString.kt")
|
||||
public void testTypeToString() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/methodsFromAny/typeToString.kt");
|
||||
|
||||
Reference in New Issue
Block a user