KT-8442 related: correct handling of erroneous destructuring references, fixes EA-90434

This commit is contained in:
Mikhail Glukhikh
2016-10-24 18:04:25 +03:00
parent e7e56ab85c
commit e53940f4af
4 changed files with 16 additions and 1 deletions
@@ -47,7 +47,8 @@ class KtDestructuringDeclarationReference(element: KtDestructuringDeclarationEnt
override val resolvesByNames: Collection<Name>
get() {
val componentIndex = (element.parent as KtDestructuringDeclaration).entries.indexOf(element) + 1
val destructuringParent = element.parent as? KtDestructuringDeclaration ?: return emptyList()
val componentIndex = destructuringParent.entries.indexOf(element) + 1
return listOf(Name.identifier("component$componentIndex"))
}
}