[kotlin] k2 change signature: replace expressions of the same type to avoid broken psi

^KTIJ-33366 fixed

GitOrigin-RevId: a897e309e9394c3e52938d3b2f6956bf67020968
This commit is contained in:
Anna Kozlova
2025-03-26 10:50:40 +00:00
committed by intellij-monorepo-bot
parent af84acc92f
commit 652a953e11
5 changed files with 30 additions and 0 deletions
@@ -12481,6 +12481,11 @@ public abstract class K2IntentionTestGenerated extends AbstractK2IntentionTest {
runTest("../../../idea/tests/testData/intentions/convertParameterToReceiver/recursiveCall1.kt");
}
@TestMetadata("simplifiedQualifier.kt")
public void testSimplifiedQualifier() throws Exception {
runTest("../../../idea/tests/testData/intentions/convertParameterToReceiver/simplifiedQualifier.kt");
}
@TestMetadata("topLevelFun.kt")
public void testTopLevelFun() throws Exception {
runTest("../../../idea/tests/testData/intentions/convertParameterToReceiver/topLevelFun.kt");
@@ -7305,6 +7305,11 @@ public abstract class K1IntentionTestGenerated extends AbstractK1IntentionTest {
runTest("testData/intentions/convertParameterToReceiver/recursiveCall1.kt");
}
@TestMetadata("simplifiedQualifier.kt")
public void testSimplifiedQualifier() throws Exception {
runTest("testData/intentions/convertParameterToReceiver/simplifiedQualifier.kt");
}
@TestMetadata("topLevelFun.kt")
public void testTopLevelFun() throws Exception {
runTest("testData/intentions/convertParameterToReceiver/topLevelFun.kt");
@@ -0,0 +1,8 @@
// WITH_STDLIB
class A {
fun foo3() = 42
fun test(<caret>a: String) {
foo3()
}
}
@@ -0,0 +1,8 @@
// WITH_STDLIB
class A {
fun foo3() = 42
fun String.test(<caret>) {
foo3()
}
}
@@ -78,6 +78,10 @@ internal class KotlinImplicitThisUsage(
element: KtElement,
allUsages: Array<out UsageInfo>
): KtElement {
val parent = element.parent
if (parent is KtCallExpression) {
return processUsage(changeInfo, parent, allUsages)
}
val newQualifiedCall = KtPsiFactory(element.project).createExpression("$newReceiver.${element.text}"
) as KtQualifiedExpression
return element.replace(newQualifiedCall).parent as KtElement