Made StandardLibraryReferenceResolver aware of class objects in built-ins.
This commit is contained in:
@@ -117,15 +117,23 @@ public class StandardLibraryReferenceResolver extends AbstractProjectComponent {
|
||||
|
||||
@Nullable
|
||||
private DeclarationDescriptor findCurrentDescriptor(@NotNull DeclarationDescriptor originalDescriptor) {
|
||||
DeclarationDescriptor parent = originalDescriptor.getContainingDeclaration();
|
||||
if (originalDescriptor instanceof ClassDescriptor) {
|
||||
return bindingContext.get(BindingContext.FQNAME_TO_CLASS_DESCRIPTOR, DescriptorUtils.getFQName(originalDescriptor).toSafe());
|
||||
if (((ClassDescriptor) originalDescriptor).getKind() == ClassKind.OBJECT) {
|
||||
if (parent == null) return null;
|
||||
parent = findCurrentDescriptor(parent);
|
||||
if (parent == null) return null;
|
||||
return ((ClassDescriptor) parent).getClassObjectDescriptor();
|
||||
}
|
||||
else {
|
||||
return bindingContext.get(BindingContext.FQNAME_TO_CLASS_DESCRIPTOR, DescriptorUtils.getFQName(originalDescriptor).toSafe());
|
||||
}
|
||||
}
|
||||
else if (originalDescriptor instanceof NamespaceDescriptor) {
|
||||
return bindingContext.get(BindingContext.FQNAME_TO_NAMESPACE_DESCRIPTOR,
|
||||
DescriptorUtils.getFQName(originalDescriptor).toSafe());
|
||||
}
|
||||
else {
|
||||
DeclarationDescriptor parent = originalDescriptor.getContainingDeclaration();
|
||||
if (parent == null) return null;
|
||||
parent = findCurrentDescriptor(parent);
|
||||
JetScope memberScope;
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
val empty = IntRange.<ref>EMPTY
|
||||
//jet/Ranges.jet:EMPTY
|
||||
+4
@@ -67,6 +67,10 @@ public class StandardLibraryReferenceResolverTest extends ResolveTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testEmptyRange() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAllReferencesResolved() {
|
||||
StandardLibraryReferenceResolver referenceResolver = getProject().getComponent(StandardLibraryReferenceResolver.class);
|
||||
for (DeclarationDescriptor descriptor : getAllStandardDescriptors(JetStandardClasses.STANDARD_CLASSES_NAMESPACE)) {
|
||||
|
||||
Reference in New Issue
Block a user