Enclosing element: do not handle parameters of for as function ones
So #KT-19626 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
7ae722492f
commit
97233448d0
@@ -803,7 +803,9 @@ public class KtPsiUtil {
|
||||
if (((KtParameter) declaration).hasValOrVar() && parent != null && parent.getParent() instanceof KtPrimaryConstructor) {
|
||||
return getEnclosingElementForLocalDeclaration(((KtPrimaryConstructor) parent.getParent()).getContainingClassOrObject(), skipParameters);
|
||||
}
|
||||
else if (skipParameters && parent != null && parent.getParent() instanceof KtNamedFunction) {
|
||||
else if (skipParameters && parent != null &&
|
||||
!(parent instanceof KtForExpression) &&
|
||||
parent.getParent() instanceof KtNamedFunction) {
|
||||
declaration = (KtNamedFunction) parent.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
// SKIP_ERRORS_BEFORE
|
||||
// SKIP_ERRORS_AFTER
|
||||
fun foo() = for (i<caret> in 1..10) {}
|
||||
@@ -0,0 +1,3 @@
|
||||
// SKIP_ERRORS_BEFORE
|
||||
// SKIP_ERRORS_AFTER
|
||||
fun foo() = for (i: Int in 1..10) {}
|
||||
@@ -15086,6 +15086,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forAsExpression.kt")
|
||||
public void testForAsExpression() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/specifyTypeExplicitly/forAsExpression.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("functionType.kt")
|
||||
public void testFunctionType() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/specifyTypeExplicitly/functionType.kt");
|
||||
|
||||
Reference in New Issue
Block a user