Move lambda out: don't report in delegation #KT-27584 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
8ea8acc7f7
commit
9b49c23668
@@ -123,6 +123,7 @@ fun KtCallExpression.getLastLambdaExpression(): KtLambdaExpression? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun KtCallExpression.canMoveLambdaOutsideParentheses(): Boolean {
|
fun KtCallExpression.canMoveLambdaOutsideParentheses(): Boolean {
|
||||||
|
if (getStrictParentOfType<KtDelegatedSuperTypeEntry>() != null) return false
|
||||||
if (getLastLambdaExpression() == null) return false
|
if (getLastLambdaExpression() == null) return false
|
||||||
|
|
||||||
val callee = calleeExpression
|
val callee = calleeExpression
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// PROBLEM: none
|
||||||
|
interface I
|
||||||
|
class C1(s: String, f: (String) -> String) : I
|
||||||
|
class C2 : I by C1("", <caret>{ "" })
|
||||||
+5
@@ -3398,6 +3398,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
|||||||
runTest("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/ambigousOverload.kt");
|
runTest("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/ambigousOverload.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("delegation.kt")
|
||||||
|
public void testDelegation() throws Exception {
|
||||||
|
runTest("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/delegation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("functionalValueCall.kt")
|
@TestMetadata("functionalValueCall.kt")
|
||||||
public void testFunctionalValueCall() throws Exception {
|
public void testFunctionalValueCall() throws Exception {
|
||||||
runTest("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/functionalValueCall.kt");
|
runTest("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/functionalValueCall.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user