Provide hashCode and equals for lookup tag based types
This commit is contained in:
committed by
Mikhail Glukhikh
parent
ce0b482413
commit
861ea6a30f
@@ -31,4 +31,19 @@ interface ConeTypeAliasLookupTag : ConeClassLikeLookupTag
|
||||
|
||||
interface ConeClassLookupTag : ConeClassLikeLookupTag
|
||||
|
||||
class ConeClassLikeLookupTagImpl(override val classId: ClassId) : ConeClassLikeLookupTag
|
||||
class ConeClassLikeLookupTagImpl(override val classId: ClassId) : ConeClassLikeLookupTag {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as ConeClassLikeLookupTagImpl
|
||||
|
||||
if (classId != other.classId) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return classId.hashCode()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,27 @@ open class ConeClassTypeImpl(
|
||||
isNullable: Boolean
|
||||
) : ConeClassType() {
|
||||
override val nullability: ConeNullability = ConeNullability.create(isNullable)
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as ConeClassTypeImpl
|
||||
|
||||
if (lookupTag != other.lookupTag) return false
|
||||
if (!typeArguments.contentEquals(other.typeArguments)) return false
|
||||
if (nullability != other.nullability) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = lookupTag.hashCode()
|
||||
result = 31 * result + typeArguments.contentHashCode()
|
||||
result = 31 * result + nullability.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class ConeAbbreviatedTypeImpl(
|
||||
|
||||
Reference in New Issue
Block a user