EA-39175 Completion fails if MultiDeclaration is present on top level in file

This commit is contained in:
Nikolay Krasko
2012-09-13 21:02:09 +04:00
parent a95ba27b7d
commit 7ad0fd56f3
4 changed files with 20 additions and 3 deletions
@@ -245,8 +245,9 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
getProperties(name);
}
}
else if (declaration instanceof JetTypedef) {
// Do nothing as typedefs are not supported
else if (declaration instanceof JetTypedef || declaration instanceof JetMultiDeclaration) {
// Do nothing for typedefs as they are not supported.
// MultiDeclarations are not supported on global level too.
}
else {
throw new IllegalArgumentException("Unsupported declaration kind: " + declaration);
@@ -64,7 +64,7 @@ public abstract class AbstractPsiBasedDeclarationProvider implements Declaration
JetClassOrObject classOrObject = (JetClassOrObject) declaration;
classesAndObjects.put(classOrObject.getNameAsName(), classOrObject);
}
else if (declaration instanceof JetParameter || declaration instanceof JetTypedef) {
else if (declaration instanceof JetParameter || declaration instanceof JetTypedef || declaration instanceof JetMultiDeclaration) {
// Do nothing, just put it into allDeclarations is enough
}
else {
@@ -0,0 +1,12 @@
data class LocalData(val first : Int, val second : Int)
val (localFirst, localSecond) = LocalData(11, 12)
fun test() {
local<caret>
}
// Test that this test won't fail with exception
// Regression for EA-39175
// ABSENT: localFirst, localSecond
@@ -100,6 +100,10 @@ public class JetBasicCompletionTest extends JetCompletionTestBase {
doTest();
}
public void testInFileWithMultiDeclaration() {
doTest();
}
public void testInFileWithTypedef() {
doTest();
}