From 72c7399df1f0be655d361839a0d901e7677f4ec3 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Mon, 21 Oct 2013 16:48:46 +0400 Subject: [PATCH] Index object declarations as inheritors --- .../org/jetbrains/jet/lang/psi/JetClass.java | 44 --------------- .../jet/lang/psi/psiUtil/jetPsiUtil.kt | 56 +++++++++++++++++++ .../psi/stubs/PsiJetClassOrObjectStub.java | 27 +++++++++ .../jet/lang/psi/stubs/PsiJetClassStub.java | 9 +-- .../jet/lang/psi/stubs/PsiJetObjectStub.java | 2 +- .../stubs/elements/JetClassElementType.java | 5 +- .../stubs/elements/JetObjectElementType.java | 26 ++++++++- .../psi/stubs/impl/PsiJetObjectStubImpl.java | 26 ++++++++- .../jet/lang/psi/stubs/impl/Utils.kt | 25 +++++++++ .../KotlinDirectInheritorsSearcher.java | 2 - .../stubindex/StubIndexServiceImpl.java | 10 +++- .../ObjectFromClass_verification.xml | 3 + .../class/sub/ObjectFromClass/main.kt | 3 + .../ObjectFromTrait_verification.xml | 3 + .../class/sub/ObjectFromTrait/main.kt | 3 + .../hierarchy/HierarchyTestGenerated.java | 9 +++ .../jet/plugin/stubs/JetStubsTest.java | 10 +++- 17 files changed, 195 insertions(+), 68 deletions(-) create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetClassOrObjectStub.java create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/Utils.kt create mode 100644 idea/testData/hierarchy/class/sub/ObjectFromClass/ObjectFromClass_verification.xml create mode 100644 idea/testData/hierarchy/class/sub/ObjectFromClass/main.kt create mode 100644 idea/testData/hierarchy/class/sub/ObjectFromTrait/ObjectFromTrait_verification.xml create mode 100644 idea/testData/hierarchy/class/sub/ObjectFromTrait/main.kt diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClass.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClass.java index 3856f9274da..c13231388a0 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClass.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClass.java @@ -218,50 +218,6 @@ public class JetClass extends JetTypeParameterListOwnerStub imp return StringUtil.join(parts, "."); } - /** - * Returns the list of unqualified names that are indexed as the superclass names of this class. For the names that might be imported - * via an aliased import, includes both the original and the aliased name (reference resolution during inheritor search will sort this out). - * - * @return the list of possible superclass names - */ - @NotNull - public List getSuperNames() { - PsiJetClassStub stub = getStub(); - if (stub != null) { - return stub.getSuperNames(); - } - - List specifiers = getDelegationSpecifiers(); - if (specifiers.size() == 0) return Collections.emptyList(); - List result = new ArrayList(); - for (JetDelegationSpecifier specifier : specifiers) { - JetUserType superType = specifier.getTypeAsUserType(); - if (superType != null) { - String referencedName = superType.getReferencedName(); - if (referencedName != null) { - addSuperName(result, referencedName); - } - } - } - return result; - } - - private void addSuperName(List result, String referencedName) { - result.add(referencedName); - if (getContainingFile() instanceof JetFile) { - JetImportDirective directive = ((JetFile) getContainingFile()).findImportByAlias(referencedName); - if (directive != null) { - JetExpression reference = directive.getImportedReference(); - while (reference instanceof JetDotQualifiedExpression) { - reference = ((JetDotQualifiedExpression) reference).getSelectorExpression(); - } - if (reference instanceof JetSimpleNameExpression) { - result.add(((JetSimpleNameExpression) reference).getReferencedName()); - } - } - } - } - @Override public ItemPresentation getPresentation() { return ItemPresentationProviders.getItemPresentation(this); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/psiUtil/jetPsiUtil.kt b/compiler/frontend/src/org/jetbrains/jet/lang/psi/psiUtil/jetPsiUtil.kt index 9b5621b9deb..718bcf67c9a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/psiUtil/jetPsiUtil.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/psiUtil/jetPsiUtil.kt @@ -23,10 +23,18 @@ import org.jetbrains.jet.lang.psi.JetDeclaration import org.jetbrains.jet.lang.psi.JetClass import org.jetbrains.jet.lang.psi.JetClassOrObject import org.jetbrains.jet.lexer.JetTokens +import java.util.Collections +import com.intellij.extapi.psi.StubBasedPsiElementBase +import org.jetbrains.jet.lang.psi.stubs.PsiJetClassOrObjectStub +import org.jetbrains.jet.lang.psi.JetFile +import org.jetbrains.jet.lang.psi.JetDotQualifiedExpression +import org.jetbrains.jet.lang.psi.JetSimpleNameExpression +import java.util.ArrayList import org.jetbrains.jet.lang.psi.JetElement import org.jetbrains.jet.lang.psi.JetBlockExpression import org.jetbrains.jet.lang.psi.JetPsiUtil import org.jetbrains.jet.lang.psi.JetPsiFactory +import kotlin.test.assertTrue fun PsiElement.getParentByTypeAndPredicate( parentClass : Class, strict : Boolean = false, predicate: (T) -> Boolean @@ -91,4 +99,52 @@ fun JetElement.wrapInBlock(): JetBlockExpression { val block = JetPsiFactory.createEmptyBody(getProject()) as JetBlockExpression block.appendElement(this) return block +} +/** + * Returns the list of unqualified names that are indexed as the superclass names of this class. For the names that might be imported + * via an aliased import, includes both the original and the aliased name (reference resolution during inheritor search will sort this out). + * + * @return the list of possible superclass names + */ +fun StubBasedPsiElementBase>.getSuperNames(): List { + fun addSuperName(result: MutableList, referencedName: String): Unit { + result.add(referencedName) + + val file = getContainingFile() + if (file is JetFile) { + val directive = file.findImportByAlias(referencedName) + if (directive != null) { + var reference = directive.getImportedReference() + while (reference is JetDotQualifiedExpression) { + reference = (reference as JetDotQualifiedExpression).getSelectorExpression() + } + if (reference is JetSimpleNameExpression) { + result.add((reference as JetSimpleNameExpression).getReferencedName()) + } + } + } + } + + assertTrue(this is JetClassOrObject) + + val stub = getStub() + if (stub != null) { + return stub.getSuperNames() + } + + val specifiers = (this as JetClassOrObject).getDelegationSpecifiers() + if (specifiers.isEmpty()) return Collections.emptyList() + + val result = ArrayList() + for (specifier in specifiers) { + val superType = specifier.getTypeAsUserType() + if (superType != null) { + val referencedName = superType.getReferencedName() + if (referencedName != null) { + addSuperName(result, referencedName) + } + } + } + + return result } \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetClassOrObjectStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetClassOrObjectStub.java new file mode 100644 index 00000000000..eac47a1c992 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetClassOrObjectStub.java @@ -0,0 +1,27 @@ +/* + * Copyright 2010-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.lang.psi.stubs; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.lang.psi.JetClassOrObject; + +import java.util.List; + +public interface PsiJetClassOrObjectStub extends PsiJetStubWithFqName { + @NotNull + List getSuperNames(); +} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetClassStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetClassStub.java index d44af99ebcb..635aac85947 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetClassStub.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetClassStub.java @@ -16,13 +16,9 @@ package org.jetbrains.jet.lang.psi.stubs; -import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.psi.JetClass; -import java.util.List; - -public interface PsiJetClassStub extends PsiJetStubWithFqName { - +public interface PsiJetClassStub extends PsiJetClassOrObjectStub { boolean isTrait(); boolean isAnnotation(); @@ -32,7 +28,4 @@ public interface PsiJetClassStub extends PsiJetStubWithFqName { boolean isInner(); boolean isEnumEntry(); - - @NotNull - List getSuperNames(); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetObjectStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetObjectStub.java index d0c30732a21..8be469dff72 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetObjectStub.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetObjectStub.java @@ -18,7 +18,7 @@ package org.jetbrains.jet.lang.psi.stubs; import org.jetbrains.jet.lang.psi.JetObjectDeclaration; -public interface PsiJetObjectStub extends PsiJetStubWithFqName { +public interface PsiJetObjectStub extends PsiJetClassOrObjectStub { boolean isTopLevel(); boolean isClassObject(); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetClassElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetClassElementType.java index eff2479e849..f0855c730f9 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetClassElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetClassElementType.java @@ -27,6 +27,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.psi.JetClass; import org.jetbrains.jet.lang.psi.JetEnumEntry; import org.jetbrains.jet.lang.psi.JetPsiUtil; +import org.jetbrains.jet.lang.psi.psiUtil.PsiUtilPackage; import org.jetbrains.jet.lang.psi.stubs.PsiJetClassStub; import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetClassStubImpl; import org.jetbrains.jet.lang.resolve.name.FqName; @@ -35,7 +36,6 @@ import java.io.IOException; import java.util.List; public class JetClassElementType extends JetStubElementType { - public JetClassElementType(@NotNull @NonNls String debugName) { super(debugName); } @@ -54,8 +54,9 @@ public class JetClassElementType extends JetStubElementType superNames = PsiUtilPackage.getSuperNames(psi); return new PsiJetClassStubImpl(getStubType(isEnumEntry), parentStub, fqName != null ? fqName.asString() : null, psi.getName(), - psi.getSuperNames(), psi.isTrait(), psi.isEnum(), isEnumEntry, psi.isAnnotation(), psi.isInner()); + superNames, psi.isTrait(), psi.isEnum(), isEnumEntry, psi.isAnnotation(), psi.isInner()); } @Override diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetObjectElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetObjectElementType.java index 4fe27414d46..54ec323a677 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetObjectElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetObjectElementType.java @@ -27,11 +27,13 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.psi.JetClassObject; import org.jetbrains.jet.lang.psi.JetObjectDeclaration; +import org.jetbrains.jet.lang.psi.psiUtil.PsiUtilPackage; import org.jetbrains.jet.lang.psi.stubs.PsiJetObjectStub; import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetObjectStubImpl; import org.jetbrains.jet.lang.resolve.name.FqName; import java.io.IOException; +import java.util.List; public class JetObjectElementType extends JetStubElementType { public JetObjectElementType(@NotNull @NonNls String debugName) { @@ -62,19 +64,30 @@ public class JetObjectElementType extends JetStubElementType superNames = PsiUtilPackage.getSuperNames(psi); + return new PsiJetObjectStubImpl( + JetStubElementTypes.OBJECT_DECLARATION, parentStub, name, fqName, superNames, psi.isTopLevel(), isClassObject(psi) + ); } @Override public void serialize(@NotNull PsiJetObjectStub stub, @NotNull StubOutputStream dataStream) throws IOException { dataStream.writeName(stub.getName()); + FqName fqName = stub.getFqName(); dataStream.writeName(fqName != null ? fqName.toString() : null); + dataStream.writeBoolean(stub.isTopLevel()); dataStream.writeBoolean(stub.isClassObject()); + + List superNames = stub.getSuperNames(); + dataStream.writeVarInt(superNames.size()); + for (String name : superNames) { + dataStream.writeName(name); + } } @NotNull @@ -83,10 +96,17 @@ public class JetObjectElementType extends JetStubElementType implements PsiJetObjectStub { private final StringRef name; private final FqName fqName; + private final StringRef[] superNames; private final boolean isTopLevel; private final boolean isClassObject; public PsiJetObjectStubImpl( @NotNull IStubElementType elementType, - @NotNull StubElement parent, + StubElement parent, @Nullable String name, @Nullable FqName fqName, + @NotNull List superNames, boolean isTopLevel, boolean isClassObject ) { - this(elementType, parent, StringRef.fromString(name), fqName, isTopLevel, isClassObject); + this(elementType, parent, StringRef.fromString(name), fqName, Utils.instance$.wrapStrings(superNames), isTopLevel, isClassObject); } public PsiJetObjectStubImpl( @NotNull IStubElementType elementType, - @NotNull StubElement parent, + StubElement parent, @Nullable StringRef name, @Nullable FqName fqName, + @NotNull StringRef[] superNames, boolean isTopLevel, boolean isClassObject) { super(parent, elementType); this.name = name; this.fqName = fqName; + this.superNames = superNames; this.isTopLevel = isTopLevel; this.isClassObject = isClassObject; } @@ -69,6 +78,16 @@ public class PsiJetObjectStubImpl extends StubBase impleme return fqName; } + @NotNull + @Override + public List getSuperNames() { + List result = new ArrayList(); + for (StringRef ref : superNames) { + result.add(ref.toString()); + } + return result; + } + @Override public boolean isTopLevel() { return isTopLevel; @@ -95,6 +114,7 @@ public class PsiJetObjectStubImpl extends StubBase impleme builder.append("name=").append(getName()); builder.append(" fqName=").append(fqName != null ? fqName.toString() : "null"); + builder.append(" superNames=").append("[").append(StringUtil.join(ArrayUtil.toStringArray(getSuperNames()))).append("]"); builder.append("]"); return builder.toString(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/Utils.kt b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/Utils.kt new file mode 100644 index 00000000000..421878afaad --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/Utils.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2010-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.lang.psi.stubs.impl + +import com.intellij.util.io.StringRef + +object Utils { + fun wrapStrings(names : List) : Array { + return Array(names.size()) { i -> StringRef.fromString(names.get(i))!! } + } +} diff --git a/idea/src/org/jetbrains/jet/plugin/search/KotlinDirectInheritorsSearcher.java b/idea/src/org/jetbrains/jet/plugin/search/KotlinDirectInheritorsSearcher.java index a4148821fbc..c160f525282 100644 --- a/idea/src/org/jetbrains/jet/plugin/search/KotlinDirectInheritorsSearcher.java +++ b/idea/src/org/jetbrains/jet/plugin/search/KotlinDirectInheritorsSearcher.java @@ -25,7 +25,6 @@ import com.intellij.util.Processor; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor; -import org.jetbrains.jet.lang.psi.JetClass; import org.jetbrains.jet.lang.psi.JetClassOrObject; import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.resolve.DescriptorUtils; @@ -61,7 +60,6 @@ public class KotlinDirectInheritorsSearcher extends QueryExecutorBase candidates = JetSuperClassIndex.getInstance().get(name, clazz.getProject(), scope); for (JetClassOrObject candidate : candidates) { - if (!(candidate instanceof JetClass)) continue; JetFile containingFile = (JetFile) candidate.getContainingFile(); KotlinCodeAnalyzer sessionForFile = AnalyzerFacadeWithCache.getLazyResolveSessionForFile(containingFile); ClassDescriptor classDescriptor = (ClassDescriptor) sessionForFile.resolveToDescriptor(candidate); diff --git a/idea/src/org/jetbrains/jet/plugin/stubindex/StubIndexServiceImpl.java b/idea/src/org/jetbrains/jet/plugin/stubindex/StubIndexServiceImpl.java index 8fa67704347..c43be7e5dd6 100644 --- a/idea/src/org/jetbrains/jet/plugin/stubindex/StubIndexServiceImpl.java +++ b/idea/src/org/jetbrains/jet/plugin/stubindex/StubIndexServiceImpl.java @@ -53,11 +53,15 @@ public class StubIndexServiceImpl implements StubIndexService { sink.occurrence(JetFullClassNameIndex.getInstance().getKey(), fqn.asString()); } + indexSuperNames(stub, sink); + + recordClassOrObjectByPackage(stub, sink); + } + + private static void indexSuperNames(PsiJetClassOrObjectStub stub, IndexSink sink) { for (String superName : stub.getSuperNames()) { sink.occurrence(JetSuperClassIndex.getInstance().getKey(), superName); } - - recordClassOrObjectByPackage(stub, sink); } @Override @@ -90,6 +94,8 @@ public class StubIndexServiceImpl implements StubIndexService { sink.occurrence(JetFullClassNameIndex.getInstance().getKey(), fqName.asString()); } + indexSuperNames(stub, sink); + recordClassOrObjectByPackage(stub, sink); } diff --git a/idea/testData/hierarchy/class/sub/ObjectFromClass/ObjectFromClass_verification.xml b/idea/testData/hierarchy/class/sub/ObjectFromClass/ObjectFromClass_verification.xml new file mode 100644 index 00000000000..9bad1269d44 --- /dev/null +++ b/idea/testData/hierarchy/class/sub/ObjectFromClass/ObjectFromClass_verification.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/idea/testData/hierarchy/class/sub/ObjectFromClass/main.kt b/idea/testData/hierarchy/class/sub/ObjectFromClass/main.kt new file mode 100644 index 00000000000..3ff7a7d66ca --- /dev/null +++ b/idea/testData/hierarchy/class/sub/ObjectFromClass/main.kt @@ -0,0 +1,3 @@ +object O: A() + +open class A \ No newline at end of file diff --git a/idea/testData/hierarchy/class/sub/ObjectFromTrait/ObjectFromTrait_verification.xml b/idea/testData/hierarchy/class/sub/ObjectFromTrait/ObjectFromTrait_verification.xml new file mode 100644 index 00000000000..9bad1269d44 --- /dev/null +++ b/idea/testData/hierarchy/class/sub/ObjectFromTrait/ObjectFromTrait_verification.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/idea/testData/hierarchy/class/sub/ObjectFromTrait/main.kt b/idea/testData/hierarchy/class/sub/ObjectFromTrait/main.kt new file mode 100644 index 00000000000..45daa84c030 --- /dev/null +++ b/idea/testData/hierarchy/class/sub/ObjectFromTrait/main.kt @@ -0,0 +1,3 @@ +object O: A + +trait A \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/plugin/hierarchy/HierarchyTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/hierarchy/HierarchyTestGenerated.java index 8769c10f9f9..2269139eec3 100644 --- a/idea/tests/org/jetbrains/jet/plugin/hierarchy/HierarchyTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/hierarchy/HierarchyTestGenerated.java @@ -189,6 +189,15 @@ public class HierarchyTestGenerated extends AbstractHierarchyTest { doSubClassHierarchyTest("idea/testData/hierarchy/class/sub/ClassFromClass"); } + @TestMetadata("ObjectFromClass") + public void testObjectFromClass() throws Exception { + doSubClassHierarchyTest("idea/testData/hierarchy/class/sub/ObjectFromClass"); + } + + @TestMetadata("ObjectFromTrait") + public void testObjectFromTrait() throws Exception { + doSubClassHierarchyTest("idea/testData/hierarchy/class/sub/ObjectFromTrait"); + } } @TestMetadata("idea/testData/hierarchy/calls/callers") diff --git a/idea/tests/org/jetbrains/jet/plugin/stubs/JetStubsTest.java b/idea/tests/org/jetbrains/jet/plugin/stubs/JetStubsTest.java index 912d0559a40..edbb6087abe 100644 --- a/idea/tests/org/jetbrains/jet/plugin/stubs/JetStubsTest.java +++ b/idea/tests/org/jetbrains/jet/plugin/stubs/JetStubsTest.java @@ -27,7 +27,9 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.psi.JetClass; import org.jetbrains.jet.lang.psi.JetDeclaration; import org.jetbrains.jet.lang.psi.JetFile; +import org.jetbrains.jet.lang.psi.JetObjectDeclaration; import org.jetbrains.jet.lang.psi.stubs.PsiJetClassStub; +import org.jetbrains.jet.lang.psi.stubs.PsiJetObjectStub; import org.jetbrains.jet.lang.psi.stubs.elements.JetFileStubBuilder; import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import org.jetbrains.jet.plugin.JetFileType; @@ -76,7 +78,7 @@ public class JetStubsTest extends LightCodeInsightFixtureTestCase { doBuildTest("class C { class object { fun foo() {} }}", "PsiJetFileStubImpl[package=]\n" + " CLASS:PsiJetClassStubImpl[name=C fqn=C superNames=[]]\n" + - " OBJECT_DECLARATION:PsiJetObjectStubImpl[class-object name=null fqName=null]\n" + + " OBJECT_DECLARATION:PsiJetObjectStubImpl[class-object name=null fqName=null superNames=[]]\n" + " FUN:PsiJetFunctionStubImpl[name=foo]\n" + " VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl\n"); } @@ -174,9 +176,11 @@ public class JetStubsTest extends LightCodeInsightFixtureTestCase { } public void testNamedObject() { - doBuildTest("object Test {}", + doBuildTest("class A\ntrait T\nobject Test: A(), T {}", "PsiJetFileStubImpl[package=]\n" + - " OBJECT_DECLARATION:PsiJetObjectStubImpl[top name=Test fqName=Test]\n"); + " CLASS:PsiJetClassStubImpl[name=A fqn=A superNames=[]]\n" + + " CLASS:PsiJetClassStubImpl[trait name=T fqn=T superNames=[]]\n" + + " OBJECT_DECLARATION:PsiJetObjectStubImpl[top name=Test fqName=Test superNames=[AT]]\n"); } public void testAnnotationOnClass() {