Cache hashCode for DataFlowValue in another field

It's necessary because DataFlowValue instances are commonly
used as keys in maps

 #KT-24657 Fixed
This commit is contained in:
Denis Zharkov
2018-07-20 16:27:08 +03:00
parent e5507108ed
commit d20e5ce673
@@ -90,7 +90,18 @@ class DataFlowValue(
override fun toString() = "$kind $identifierInfo $immanentNullability"
override fun hashCode() = type.hashCode() + 31 * identifierInfo.hashCode()
private var hashCode = 0
override fun hashCode(): Int {
var hashCode = hashCode
if (hashCode == 0) {
hashCode = type.hashCode() + 31 * identifierInfo.hashCode()
this.hashCode = hashCode
}
return hashCode
}
companion object {