[FE 1.0] Keep the same type attributes during union or intersection type attributes
^KT-51317 Fixed
This commit is contained in:
@@ -10,9 +10,11 @@ import org.jetbrains.kotlin.descriptors.annotations.composeAnnotations
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
class AnnotationsTypeAttribute(val annotations: Annotations) : TypeAttribute<AnnotationsTypeAttribute>() {
|
||||
override fun union(other: AnnotationsTypeAttribute?): AnnotationsTypeAttribute? = null
|
||||
override fun union(other: AnnotationsTypeAttribute?): AnnotationsTypeAttribute? =
|
||||
if (other == this) this else null
|
||||
|
||||
override fun intersect(other: AnnotationsTypeAttribute?): AnnotationsTypeAttribute? = null
|
||||
override fun intersect(other: AnnotationsTypeAttribute?): AnnotationsTypeAttribute? =
|
||||
if (other == this) this else null
|
||||
|
||||
override fun add(other: AnnotationsTypeAttribute?): AnnotationsTypeAttribute {
|
||||
if (other == null) return this
|
||||
@@ -23,6 +25,13 @@ class AnnotationsTypeAttribute(val annotations: Annotations) : TypeAttribute<Ann
|
||||
|
||||
override val key: KClass<out AnnotationsTypeAttribute>
|
||||
get() = AnnotationsTypeAttribute::class
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is AnnotationsTypeAttribute) return false
|
||||
return other.annotations == this.annotations
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = annotations.hashCode()
|
||||
}
|
||||
|
||||
val TypeAttributes.annotationsAttribute: AnnotationsTypeAttribute? by TypeAttributes.attributeAccessor<AnnotationsTypeAttribute>()
|
||||
|
||||
Reference in New Issue
Block a user