diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java index 5bbfb9498d8..9b2c4c0a56c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java @@ -142,7 +142,10 @@ public class KtDestructuringDeclarationEntry extends KtNamedDeclarationNotStubbe @NotNull @Override public SearchScope getUseScope() { - KtElement enclosingBlock = KtPsiUtil.getEnclosingElementForLocalDeclaration(this, true); + KtElement enclosingBlock = KtPsiUtil.getEnclosingElementForLocalDeclaration(this, false); + if (enclosingBlock instanceof KtParameter) { + enclosingBlock = KtPsiUtil.getEnclosingElementForLocalDeclaration((KtParameter) enclosingBlock, false); + } if (enclosingBlock != null) return new LocalSearchScope(enclosingBlock); return super.getUseScope(); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtPsiUtil.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtPsiUtil.java index 424083ec3ec..9e0cf357981 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtPsiUtil.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtPsiUtil.java @@ -796,7 +796,7 @@ public class KtPsiUtil { return (KtElement) parent; } } - if (current instanceof KtBlockExpression || (current instanceof KtParameter && !skipParameters)) { + if (current instanceof KtBlockExpression || current instanceof KtParameter) { return (KtElement) current; } if (current instanceof KtValueArgument) {