[Invariant Fix] Adjust DataFlowValue::Identifier for refinement

After refinement is introduced it becomes possible to have a different
descriptors instances for effectively the same descriptors

Also, it accidentally fixes KT-25432 because is caused by a different
version of descriptors created for NewCapturedType

^KT-25432 Fixed
This commit is contained in:
Denis Zharkov
2019-04-04 15:43:42 +03:00
committed by Dmitry Savvinov
parent 21cc93860b
commit daa27016ca
4 changed files with 145 additions and 143 deletions
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.lexer.KtToken
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorEquivalenceForOverrides
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.calls.callUtil.isSafeCall
@@ -59,9 +60,10 @@ interface IdentifierInfo {
override val canBeBound
get() = kind == STABLE_VALUE
override fun equals(other: Any?) = other is Variable && variable == other.variable
override fun equals(other: Any?) =
other is Variable && DescriptorEquivalenceForOverrides.areCallableDescriptorsEquivalent(variable, other.variable)
override fun hashCode() = variable.hashCode()
override fun hashCode() = variable.name.hashCode() * 31 + variable.containingDeclaration.original.hashCode()
override fun toString() = variable.toString()
}