Fix shortening references for return type in MakeTypeExplicitInLambdaIntention
#KT-5475 Fixed
This commit is contained in:
@@ -88,9 +88,9 @@ public class MakeTypeExplicitInLambdaIntention : JetSelfTargetingIntention<JetFu
|
|||||||
val paramList = functionLiteral.getValueParameterList()
|
val paramList = functionLiteral.getValueParameterList()
|
||||||
val returnTypeColon = psiFactory.createColon()
|
val returnTypeColon = psiFactory.createColon()
|
||||||
val returnTypeExpr = psiFactory.createType(DescriptorRenderer.SOURCE_CODE.renderType(expectedReturnType))
|
val returnTypeExpr = psiFactory.createType(DescriptorRenderer.SOURCE_CODE.renderType(expectedReturnType))
|
||||||
ShortenReferences.process(returnTypeExpr)
|
|
||||||
functionLiteral.addAfter(returnTypeExpr, paramList)
|
functionLiteral.addAfter(returnTypeExpr, paramList)
|
||||||
functionLiteral.addAfter(returnTypeColon, paramList)
|
functionLiteral.addAfter(returnTypeColon, paramList)
|
||||||
|
ShortenReferences.process(functionLiteral.getReturnTypeRef()!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 3: make the receiver type explicit
|
// Step 3: make the receiver type explicit
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
fun main(c: kotlin.support.AbstractIterator<Int>) {
|
||||||
|
val f = { <caret>(x: Int) -> c}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WITH_RUNTIME
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
import kotlin.support.AbstractIterator
|
||||||
|
|
||||||
|
fun main(c: kotlin.support.AbstractIterator<Int>) {
|
||||||
|
val f = {(x: Int): AbstractIterator<Int> -> c}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WITH_RUNTIME
|
||||||
@@ -3510,6 +3510,11 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
|||||||
doTest("idea/testData/intentions/makeTypeExplicitInLambda/shortenReferencesForReceiver.kt");
|
doTest("idea/testData/intentions/makeTypeExplicitInLambda/shortenReferencesForReceiver.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("shortenReferencesForReturnType.kt")
|
||||||
|
public void testShortenReferencesForReturnType() throws Exception {
|
||||||
|
doTest("idea/testData/intentions/makeTypeExplicitInLambda/shortenReferencesForReturnType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("singleParam.kt")
|
@TestMetadata("singleParam.kt")
|
||||||
public void testSingleParam() throws Exception {
|
public void testSingleParam() throws Exception {
|
||||||
doTest("idea/testData/intentions/makeTypeExplicitInLambda/singleParam.kt");
|
doTest("idea/testData/intentions/makeTypeExplicitInLambda/singleParam.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user