Move lambda out: don't report in delegation #KT-27584 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-10-15 23:04:19 +09:00
committed by Mikhail Glukhikh
parent 8ea8acc7f7
commit 9b49c23668
3 changed files with 10 additions and 0 deletions
@@ -123,6 +123,7 @@ fun KtCallExpression.getLastLambdaExpression(): KtLambdaExpression? {
}
fun KtCallExpression.canMoveLambdaOutsideParentheses(): Boolean {
if (getStrictParentOfType<KtDelegatedSuperTypeEntry>() != null) return false
if (getLastLambdaExpression() == null) return false
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>{ "" })
@@ -3398,6 +3398,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
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")
public void testFunctionalValueCall() throws Exception {
runTest("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/functionalValueCall.kt");