diff --git a/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/DescriptorUtils.kt b/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/DescriptorUtils.kt index 0356f9cdc1b..64483537608 100644 --- a/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/DescriptorUtils.kt +++ b/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/DescriptorUtils.kt @@ -71,7 +71,28 @@ private fun StringBuilder.appendErasedType(typeRef: FirTypeRef) { } } +private val PRIMITIVE_TYPE_SIGNATURE: Map = mapOf( + "Boolean" to "Z", + "Byte" to "B", + "Char" to "C", + "Short" to "S", + "Int" to "I", + "Long" to "L", + "Float" to "F", + "Double" to "D", +) + private fun StringBuilder.appendConeType(coneType: ConeKotlinType) { + (coneType as? ConeClassLikeType)?.let { + val classId = it.lookupTag.classId + if (classId.packageFqName.toString() == "kotlin") { + PRIMITIVE_TYPE_SIGNATURE[classId.shortClassName.identifier]?.let { + append(it) + return + } + } + } + fun appendClassLikeType(type: ConeClassLikeType) { append("L") val classId = type.lookupTag.classId diff --git a/compiler/fir/resolve/testData/resolveWithStdlib/removeIf.kt b/compiler/fir/resolve/testData/resolveWithStdlib/removeIf.kt new file mode 100644 index 00000000000..62618901e03 --- /dev/null +++ b/compiler/fir/resolve/testData/resolveWithStdlib/removeIf.kt @@ -0,0 +1,5 @@ +// FULL_JDK + +fun test(collection: MutableCollection) { + collection.removeIf { it } +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolveWithStdlib/removeIf.txt b/compiler/fir/resolve/testData/resolveWithStdlib/removeIf.txt new file mode 100644 index 00000000000..0403f22e9aa --- /dev/null +++ b/compiler/fir/resolve/testData/resolveWithStdlib/removeIf.txt @@ -0,0 +1,7 @@ +FILE: removeIf.kt + public final fun test(collection: R|kotlin/collections/MutableCollection|): R|kotlin/Unit| { + R|/collection|.R|FakeOverride|( = removeIf@fun (it: R|ft!|): R|kotlin/Boolean| { + ^ R|/it| + } + ) + } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java index 9002e7f32df..4a9b05b921b 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java @@ -198,6 +198,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic runTest("compiler/fir/resolve/testData/resolveWithStdlib/reflectionClass.kt"); } + @TestMetadata("removeIf.kt") + public void testRemoveIf() throws Exception { + runTest("compiler/fir/resolve/testData/resolveWithStdlib/removeIf.kt"); + } + @TestMetadata("removeOnAbstractMap.kt") public void testRemoveOnAbstractMap() throws Exception { runTest("compiler/fir/resolve/testData/resolveWithStdlib/removeOnAbstractMap.kt"); diff --git a/compiler/testData/diagnostics/tests/targetedBuiltIns/removeIf.fir.kt b/compiler/testData/diagnostics/tests/targetedBuiltIns/removeIf.fir.kt index 3ecc5f3048e..9d060661f41 100644 --- a/compiler/testData/diagnostics/tests/targetedBuiltIns/removeIf.fir.kt +++ b/compiler/testData/diagnostics/tests/targetedBuiltIns/removeIf.fir.kt @@ -7,6 +7,6 @@ interface A : MutableCollection { } fun foo(x: MutableList, y: A) { - x.removeIf { it.length > 0 } + x.removeIf { it.length > 0 } y.removeIf { it.length > 0 } }