From de865c6d463616bfa6aeb7a72f149ef7f17fb048 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 4 Oct 2016 15:36:42 +0300 Subject: [PATCH] getUseScope() fixed for destructuring declarations #KT-14181 Fixed --- .../jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java | 2 +- compiler/frontend/src/org/jetbrains/kotlin/psi/KtPsiUtil.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java index 3fe4458826d..5bbfb9498d8 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java @@ -142,7 +142,7 @@ public class KtDestructuringDeclarationEntry extends KtNamedDeclarationNotStubbe @NotNull @Override public SearchScope getUseScope() { - KtElement enclosingBlock = KtPsiUtil.getEnclosingElementForLocalDeclaration(this, false); + KtElement enclosingBlock = KtPsiUtil.getEnclosingElementForLocalDeclaration(this, true); 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 9e0cf357981..424083ec3ec 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) { + if (current instanceof KtBlockExpression || (current instanceof KtParameter && !skipParameters)) { return (KtElement) current; } if (current instanceof KtValueArgument) {