Inline function: fix it works correctly for callable reference receiver
#KT-26248 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
272ca002d7
commit
6b2e58cc0b
@@ -142,6 +142,7 @@ private fun UsageReplacementStrategy.specialUsageProcessing(
|
||||
): Boolean {
|
||||
when (val usageParent = usage.parent) {
|
||||
is KtCallableReferenceExpression -> {
|
||||
if (usageParent.callableReference != usage) return false
|
||||
val grandParent = usageParent.parent
|
||||
ConvertReferenceToLambdaIntention().applyTo(usageParent, null)
|
||||
(grandParent as? KtElement)?.let {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
fun main() {
|
||||
val first = listOf("hello")
|
||||
val second = listOf("hello", "world")
|
||||
val result = second.any(<caret>first::contains)
|
||||
println(result)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun main() {
|
||||
val second = listOf("hello", "world")
|
||||
val result = second.any(listOf("hello")::contains)
|
||||
println(result)
|
||||
}
|
||||
+5
@@ -80,6 +80,11 @@ public class InlineTestGenerated extends AbstractInlineTest {
|
||||
runTest("idea/testData/refactoring/inline/function/Reference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ReferenceReceiver.kt")
|
||||
public void testReferenceReceiver() throws Exception {
|
||||
runTest("idea/testData/refactoring/inline/function/ReferenceReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ReturnNotInTheEnd.kt")
|
||||
public void testReturnNotInTheEnd() throws Exception {
|
||||
runTest("idea/testData/refactoring/inline/function/ReturnNotInTheEnd.kt");
|
||||
|
||||
Reference in New Issue
Block a user