Add equals/hashCode to some FIR cone types

This commit is contained in:
Simon Ogorodnik
2019-05-15 15:48:54 +03:00
committed by Mikhail Glukhikh
parent aa96837758
commit 9266a2cdba
2 changed files with 22 additions and 2 deletions
@@ -30,12 +30,12 @@ interface ConeTypedProjection {
val type: ConeKotlinType
}
class ConeKotlinTypeProjectionIn(override val type: ConeKotlinType) : ConeKotlinTypeProjection(), ConeTypedProjection {
data class ConeKotlinTypeProjectionIn(override val type: ConeKotlinType) : ConeKotlinTypeProjection(), ConeTypedProjection {
override val kind: ProjectionKind
get() = ProjectionKind.IN
}
class ConeKotlinTypeProjectionOut(override val type: ConeKotlinType) : ConeKotlinTypeProjection(), ConeTypedProjection {
data class ConeKotlinTypeProjectionOut(override val type: ConeKotlinType) : ConeKotlinTypeProjection(), ConeTypedProjection {
override val kind: ProjectionKind
get() = ProjectionKind.OUT
}
@@ -57,4 +57,24 @@ class ConeTypeParameterTypeImpl(
get() = EMPTY_ARRAY
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 ConeTypeParameterTypeImpl
if (lookupTag != other.lookupTag) return false
if (nullability != other.nullability) return false
return true
}
override fun hashCode(): Int {
var result = lookupTag.hashCode()
result = 31 * result + nullability.hashCode()
return result
}
}