FIR: Prepare ConeAttribute infrastructure for non-singleton attrs

This commit is contained in:
Denis.Zharkov
2022-02-17 16:07:57 +03:00
committed by teamcity
parent 54c3e7e7c5
commit f3e28c3767
5 changed files with 33 additions and 30 deletions
@@ -408,8 +408,8 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
}
private fun AnnotationMarker.isCustomAttribute(): Boolean {
val compilerAttributes = CompilerConeAttributes.classIdByCompilerAttribute
return this !in compilerAttributes && this !is CustomAnnotationTypeAttribute
val compilerAttributes = CompilerConeAttributes.classIdByCompilerAttributeKey
return (this as? ConeAttribute<*>)?.key !in compilerAttributes && this !is CustomAnnotationTypeAttribute
}
override fun KotlinTypeMarker.replaceCustomAttributes(newAttributes: List<AnnotationMarker>): KotlinTypeMarker {
@@ -429,14 +429,14 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
override fun KotlinTypeMarker.hasCustomAttributes(): Boolean {
require(this is ConeKotlinType)
val compilerAttributes = CompilerConeAttributes.classIdByCompilerAttribute
return this.attributes.any { it !in compilerAttributes && it !is CustomAnnotationTypeAttribute }
val compilerAttributes = CompilerConeAttributes.classIdByCompilerAttributeKey
return this.attributes.any { it.key !in compilerAttributes && it !is CustomAnnotationTypeAttribute }
}
override fun KotlinTypeMarker.getCustomAttributes(): List<AnnotationMarker> {
require(this is ConeKotlinType)
val compilerAttributes = CompilerConeAttributes.classIdByCompilerAttribute
return attributes.filterNot { it in compilerAttributes || it is CustomAnnotationTypeAttribute }
val compilerAttributes = CompilerConeAttributes.classIdByCompilerAttributeKey
return attributes.filterNot { it.key in compilerAttributes || it is CustomAnnotationTypeAttribute }
}
override fun SimpleTypeMarker.isStubType(): Boolean {
@@ -520,7 +520,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
override fun KotlinTypeMarker.hasAnnotation(fqName: FqName): Boolean {
require(this is ConeKotlinType)
val compilerAttribute = CompilerConeAttributes.compilerAttributeByFqName[fqName]
val compilerAttribute = CompilerConeAttributes.compilerAttributeKeyByFqName[fqName]
if (compilerAttribute != null) {
return compilerAttribute in attributes
}