K2: Refine mapping of primitive arrays to JVM descriptor
Earlier, it wasn't really important but after the previous commit when JvmMappedScope semantics has been changed, we erroneously started loading `toCharArray` as a member to String because its jvmDescriptor was computed to "toCharArray()Lkotlin/CharArray", while hardcoded information that prevents it from loading expect "toCharArray()[C" there. ^KT-57694 In progress
This commit is contained in:
committed by
Space Team
parent
2e5b783cc6
commit
e4480a1c52
+6
@@ -29921,6 +29921,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeIf.kt")
|
||||
public void testRemoveIf() throws Exception {
|
||||
|
||||
+6
@@ -29921,6 +29921,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeIf.kt")
|
||||
public void testRemoveIf() throws Exception {
|
||||
|
||||
@@ -69,6 +69,13 @@ private val PRIMITIVE_TYPE_SIGNATURE: Map<String, String> = mapOf(
|
||||
"Double" to "D",
|
||||
)
|
||||
|
||||
private val PRIMITIVE_TYPE_ARRAYS_SIGNATURE: Map<String, String> =
|
||||
PRIMITIVE_TYPE_SIGNATURE.map { (name, desc) ->
|
||||
"${name}Array" to "[$desc"
|
||||
}.toMap()
|
||||
|
||||
private val PRIMITIVE_TYPE_OR_ARRAY_SIGNATURE: Map<String, String> = PRIMITIVE_TYPE_SIGNATURE + PRIMITIVE_TYPE_ARRAYS_SIGNATURE
|
||||
|
||||
fun ConeKotlinType.computeJvmDescriptorRepresentation(
|
||||
typeConversion: (FirTypeRef) -> ConeKotlinType? = FirTypeRef::coneTypeSafe
|
||||
): String = buildString {
|
||||
@@ -82,7 +89,7 @@ private fun StringBuilder.appendConeType(
|
||||
(coneType as? ConeClassLikeType)?.let {
|
||||
val classId = it.lookupTag.classId
|
||||
if (classId.packageFqName.toString() == "kotlin") {
|
||||
PRIMITIVE_TYPE_SIGNATURE[classId.shortClassName.identifier]?.let { signature ->
|
||||
PRIMITIVE_TYPE_OR_ARRAY_SIGNATURE[classId.shortClassName.identifier]?.let { signature ->
|
||||
append(signature)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
internal val wildcardChars = "OK".toCharArray()
|
||||
|
||||
fun box(): String = "${wildcardChars[0]}${wildcardChars[1]}"
|
||||
+6
@@ -28445,6 +28445,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeIf.kt")
|
||||
public void testRemoveIf() throws Exception {
|
||||
|
||||
+6
@@ -29921,6 +29921,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeIf.kt")
|
||||
public void testRemoveIf() throws Exception {
|
||||
|
||||
+6
@@ -29921,6 +29921,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeIf.kt")
|
||||
public void testRemoveIf() throws Exception {
|
||||
|
||||
+5
@@ -24093,6 +24093,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("removeIf.kt")
|
||||
public void testRemoveIf() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/removeIf.kt");
|
||||
|
||||
+6
@@ -21718,6 +21718,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
public void testKt1397() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -21868,6 +21868,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
public void testKt1397() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -21868,6 +21868,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
public void testKt1397() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -21868,6 +21868,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
public void testKt1397() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -24826,6 +24826,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
public void testKt1397() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -25336,6 +25336,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
public void testKt1397() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -24572,6 +24572,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
public void testKt1397() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -24827,6 +24827,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
public void testKt1397() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
Generated
+5
@@ -19320,6 +19320,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
public void testKt1397() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/kt1397.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noStringToCharArray.kt")
|
||||
public void testNoStringToCharArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jdk/noStringToCharArray.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/js")
|
||||
|
||||
Reference in New Issue
Block a user