"lambda to anonymous": add tests for qualified types (KT-7710)
This commit is contained in:
@@ -43,7 +43,6 @@ class LambdaToAnonymousFunctionIntention : SelfTargetingIntention<KtLambdaExpres
|
||||
if (it.getTargetFunctionDescriptor(context) == descriptor) it.labeledExpression?.delete()
|
||||
}
|
||||
|
||||
// TODO: check type rendering (!!!)
|
||||
val anonymousFunction = psiFactory.createFunction(
|
||||
KtPsiFactory.CallableBuilder(KtPsiFactory.CallableBuilder.Target.FUNCTION).apply {
|
||||
typeParams()
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// RUNTIME_WITH_FULL_JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun foo(f: () -> ArrayDeque<*>) {}
|
||||
|
||||
fun test() {
|
||||
foo <caret>{ ArrayDeque<Int>() }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// RUNTIME_WITH_FULL_JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun foo(f: () -> ArrayDeque<*>) {}
|
||||
|
||||
fun test() {
|
||||
foo(fun(): ArrayDeque<Int> {
|
||||
return ArrayDeque<Int>()
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
package test
|
||||
|
||||
data class My(val x: Int)
|
||||
|
||||
fun foo(f: () -> My) {}
|
||||
|
||||
fun test() {
|
||||
foo <caret>{ My(42) }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
package test
|
||||
|
||||
data class My(val x: Int)
|
||||
|
||||
fun foo(f: () -> My) {}
|
||||
|
||||
fun test() {
|
||||
foo(fun(): My {
|
||||
return My(42)
|
||||
})
|
||||
}
|
||||
@@ -9664,6 +9664,11 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
runTest("idea/testData/intentions/lambdaToAnonymousFunction/extention2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fullyQualified.kt")
|
||||
public void testFullyQualified() throws Exception {
|
||||
runTest("idea/testData/intentions/lambdaToAnonymousFunction/fullyQualified.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("hasComment.kt")
|
||||
public void testHasComment() throws Exception {
|
||||
runTest("idea/testData/intentions/lambdaToAnonymousFunction/hasComment.kt");
|
||||
@@ -9723,6 +9728,11 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
public void testVariable() throws Exception {
|
||||
runTest("idea/testData/intentions/lambdaToAnonymousFunction/variable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withPackage.kt")
|
||||
public void testWithPackage() throws Exception {
|
||||
runTest("idea/testData/intentions/lambdaToAnonymousFunction/withPackage.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/intentions/loopToCallChain")
|
||||
|
||||
Reference in New Issue
Block a user