Handle properly lambda change in incremental analysis
Fixed #KT-37273
This commit is contained in:
+1
-1
@@ -216,7 +216,7 @@ class KotlinCodeBlockModificationListener(
|
||||
fun getInsideCodeBlockModificationScope(element: PsiElement): BlockModificationScopeElement? {
|
||||
val lambda = element.getTopmostParentOfType<KtLambdaExpression>()
|
||||
if (lambda is KtLambdaExpression) {
|
||||
lambda.getTopmostParentOfType<KtSuperTypeCallEntry>()?.let {
|
||||
lambda.getTopmostParentOfType<KtSuperTypeCallEntry>()?.getTopmostParentOfType<KtClassOrObject>()?.let {
|
||||
return BlockModificationScopeElement(it, it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// OUT_OF_CODE_BLOCK: FALSE
|
||||
// TYPE: 1
|
||||
// ERROR: Unresolved reference: i1
|
||||
open class Base(init: () -> Unit)
|
||||
|
||||
class Some(i: Int) : Base({
|
||||
val t = i<caret>
|
||||
})
|
||||
@@ -1,5 +1,7 @@
|
||||
// OUT_OF_CODE_BLOCK: FALSE
|
||||
|
||||
// ERROR: Unresolved reference: a
|
||||
// ERROR: Unsupported [literal prefixes and suffixes]
|
||||
// ERROR: None of the following functions can be called with the arguments supplied: <br>public constructor A(x: Int) defined in A<br>public constructor A(l: String) defined in A
|
||||
// Navigation from "class B: A()" should move to valid constructor even after changing type in lambda
|
||||
|
||||
open class A(l: String) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// OUT_OF_CODE_BLOCK: FALSE
|
||||
|
||||
// ERROR: Unresolved reference: a
|
||||
// ERROR: Unsupported [literal prefixes and suffixes]
|
||||
open class A(a: () -> Unit)
|
||||
|
||||
class B: A({ "1"<caret> })
|
||||
+5
@@ -253,6 +253,11 @@ public class OutOfBlockModificationTestGenerated extends AbstractOutOfBlockModif
|
||||
runTest("idea/testData/codeInsight/outOfBlock/InSecondaryConstructorParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InSuperCtorLambda.kt")
|
||||
public void testInSuperCtorLambda() throws Exception {
|
||||
runTest("idea/testData/codeInsight/outOfBlock/InSuperCtorLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InSuperTypeCallCallInLambdaInCall.kt")
|
||||
public void testInSuperTypeCallCallInLambdaInCall() throws Exception {
|
||||
runTest("idea/testData/codeInsight/outOfBlock/InSuperTypeCallCallInLambdaInCall.kt");
|
||||
|
||||
Reference in New Issue
Block a user