Improve toString of platform types created by typeOf

In the stdlib implementation, render "!" if the type is only
nullability-flexible. Otherwise, render "($lower..$upper)".

Note that full kotlin-reflect has a much more complicated logic (see
`DescriptorRendererImpl.renderFlexibleType`) that renders things like
`(Mutable)List` and so on. It is not a goal of the stdlib implementation
to replicate all of that, since it requires copying a large amount of
code, namely the entirety of `JavaToKotlinClassMap` to map Java class
names to Kotlin.
This commit is contained in:
Alexander Udalov
2021-07-08 22:34:43 +02:00
parent ddfa94e7e9
commit a7e48c3af1
10 changed files with 157 additions and 12 deletions
@@ -29840,6 +29840,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/reflection/typeOf/nothing_before.kt");
}
@TestMetadata("primitiveJavaTypes.kt")
public void testPrimitiveJavaTypes() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/primitiveJavaTypes.kt");
}
@TestMetadata("rawTypes_after.kt")
public void testRawTypes_after() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/rawTypes_after.kt");
@@ -29920,6 +29925,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/reflection/typeOf/noReflect/nothing_before.kt");
}
@TestMetadata("primitiveJavaTypes.kt")
public void testPrimitiveJavaTypes() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/noReflect/primitiveJavaTypes.kt");
}
@TestMetadata("rawTypes_after.kt")
public void testRawTypes_after() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/noReflect/rawTypes_after.kt");