From 0bc8efa20d690f724c207ebc40f1c974da53a716 Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Wed, 4 Mar 2015 18:28:02 +0300 Subject: [PATCH] Reverted old behaviour of DescriptorToSourceUtils.descriptorToDeclaration() --- .../kotlin/resolve/DescriptorToSourceUtils.kt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorToSourceUtils.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorToSourceUtils.kt index 0fdaeeeb9e7..e5512dc68ff 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorToSourceUtils.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorToSourceUtils.kt @@ -59,17 +59,12 @@ public object DescriptorToSourceUtils { // NOTE this is also used by KDoc // Returns PSI element for descriptor. If there are many relevant elements (e.g. it is fake override - // with multiple declarations), finds any of them. It can't find declarations in builtins or decompiled code. + // with multiple declarations), returns null. It can't find declarations in builtins or decompiled code. // In IDE, use DescriptorToSourceUtilsIde instead. platformStatic public fun descriptorToDeclaration(descriptor: DeclarationDescriptor): PsiElement? { - for (declarationDescriptor in getEffectiveReferencedDescriptors(descriptor.getOriginal())) { - val source = getSourceFromDescriptor(declarationDescriptor) - if (source != null) { - return source - } - } - return null + val effectiveReferencedDescriptors = getEffectiveReferencedDescriptors(descriptor) + return if (effectiveReferencedDescriptors.size() == 1) getSourceFromDescriptor(effectiveReferencedDescriptors.firstOrNull()!!) else null } platformStatic