[FIR] Let attributes opt-in to participating in ConeClassLikeTypeImpl structural equality

This is required for EnhancedTypeForWarningAttribute because scopes
should not be reused between cone types with different values of
this attribute.

#KT-63208
This commit is contained in:
Kirill Rakhman
2024-01-05 15:10:28 +01:00
committed by Space Team
parent 931cc48def
commit 9189154cae
11 changed files with 58 additions and 92 deletions
@@ -25,6 +25,25 @@ class EnhancedTypeForWarningAttribute(
override val keepInInferredDeclarationType: Boolean
get() = true
override val implementsEquality: Boolean
get() = true
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as EnhancedTypeForWarningAttribute
if (coneType != other.coneType) return false
return true
}
override fun hashCode(): Int {
var result = coneType.hashCode()
return result
}
}
val ConeAttributes.enhancedTypeForWarning: EnhancedTypeForWarningAttribute? by ConeAttributes.attributeAccessor<EnhancedTypeForWarningAttribute>()