From d9893d994014aae356672aa10221af18fa0caff6 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Mon, 30 Jul 2012 19:10:35 +0400 Subject: [PATCH] EA-36815 Fixed (assert: JetLookupObject.equals) --- .../jet/plugin/completion/JetLookupObject.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/idea/src/org/jetbrains/jet/plugin/completion/JetLookupObject.java b/idea/src/org/jetbrains/jet/plugin/completion/JetLookupObject.java index 0628f4c25d6..bb426044c8e 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/JetLookupObject.java +++ b/idea/src/org/jetbrains/jet/plugin/completion/JetLookupObject.java @@ -21,6 +21,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; import org.jetbrains.jet.lang.resolve.BindingContext; +import org.jetbrains.jet.resolve.DescriptorRenderer; /** * Stores information about resolved descriptor and position of that descriptor. @@ -77,10 +78,18 @@ public final class JetLookupObject { // Same descriptor - same lookup element if (descriptor != null && other.descriptor != null) { - assert context == other.context : "Can't compare descriptors from different binding context"; - - if (descriptor.equals(other.descriptor)) { - return true; + if (context == other.context) { + if (descriptor.equals(other.descriptor)) { + return true; + } + } + else { + String descriptorText = DescriptorRenderer.TEXT.render(descriptor); + @SuppressWarnings("ConstantConditions") + String otherDescriptorText = DescriptorRenderer.TEXT.render(other.descriptor); + if (descriptorText.equals(otherDescriptorText)) { + return true; + } } }