Enclosing element: do not handle parameters of for as function ones

So #KT-19626 Fixed
This commit is contained in:
Mikhail Glukhikh
2017-09-11 12:10:53 +03:00
committed by Mikhail Glukhikh
parent 7ae722492f
commit 97233448d0
4 changed files with 15 additions and 1 deletions
@@ -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();
}
}