Intentions: Fix contentRange() on empty KtBlockExpression
#KT-10776 Fixed
This commit is contained in:
@@ -179,6 +179,7 @@ fun KtBlockExpression.contentRange(): PsiChildRange {
|
|||||||
val last = rBrace!!
|
val last = rBrace!!
|
||||||
.siblings(forward = false, withItself = false)
|
.siblings(forward = false, withItself = false)
|
||||||
.first { it !is PsiWhiteSpace }
|
.first { it !is PsiWhiteSpace }
|
||||||
|
if (last == lBrace) return PsiChildRange.EMPTY
|
||||||
return PsiChildRange(first, last)
|
return PsiChildRange(first, last)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
fun acceptLambda(f: () -> Unit) = f()
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
acceptLambda(<caret>fun(): Unit {})
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
fun acceptLambda(f: () -> Unit) = f()
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
acceptLambda { }
|
||||||
|
}
|
||||||
@@ -439,6 +439,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("emptyBody.kt")
|
||||||
|
public void testEmptyBody() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/anonymousFunctionToLambda/emptyBody.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("expressionBody.kt")
|
@TestMetadata("expressionBody.kt")
|
||||||
public void testExpressionBody() throws Exception {
|
public void testExpressionBody() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/anonymousFunctionToLambda/expressionBody.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/anonymousFunctionToLambda/expressionBody.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user