[FIR] Introduce UnsafeVariance attribute (see KT-41792)

This commit is contained in:
Mikhail Glukhikh
2020-09-10 15:07:11 +03:00
parent e4aaae9ae7
commit aa897db132
3 changed files with 22 additions and 1 deletions
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.fir.types
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.utils.addToStdlib.runIf
import kotlin.reflect.KClass
object CompilerConeAttributes {
@@ -41,8 +40,19 @@ object CompilerConeAttributes {
override val key: KClass<out ExtensionFunctionType> = ExtensionFunctionType::class
}
object UnsafeVariance : ConeAttribute<UnsafeVariance>() {
val ANNOTATION_CLASS_ID = ClassId(FqName("kotlin"), Name.identifier("UnsafeVariance"))
override fun union(other: UnsafeVariance?): UnsafeVariance? = null
override fun intersect(other: UnsafeVariance?): UnsafeVariance? = null
override fun isSubtypeOf(other: UnsafeVariance?): Boolean = true
override val key: KClass<out UnsafeVariance> = UnsafeVariance::class
}
}
val ConeAttributes.exact: CompilerConeAttributes.Exact? by ConeAttributes.attributeAccessor<CompilerConeAttributes.Exact>()
val ConeAttributes.noInfer: CompilerConeAttributes.NoInfer? by ConeAttributes.attributeAccessor<CompilerConeAttributes.NoInfer>()
val ConeAttributes.extensionFunctionType: CompilerConeAttributes.ExtensionFunctionType? by ConeAttributes.attributeAccessor<CompilerConeAttributes.ExtensionFunctionType>()
val ConeAttributes.unsafeVarianceType: CompilerConeAttributes.UnsafeVariance? by ConeAttributes.attributeAccessor<CompilerConeAttributes.UnsafeVariance>()