FIR2IR: read extension function type attribute properly

This commit is contained in:
Mikhail Glukhikh
2021-11-09 09:08:17 +03:00
committed by teamcityserver
parent b2d020606e
commit d6bc6bec59
21 changed files with 46 additions and 179 deletions
@@ -37,6 +37,13 @@ class Fir2IrBuiltIns(
internal fun flexibleNullabilityAnnotationConstructorCall(): IrConstructorCall? =
flexibleNullabilityAnnotationSymbol?.toConstructorCall()
private val extensionFunctionTypeAnnotationSymbol by lazy {
annotationSymbolById(StandardClassIds.Annotations.ExtensionFunctionType)
}
internal fun extensionFunctionTypeAnnotationConstructorCall(): IrConstructorCall? =
extensionFunctionTypeAnnotationSymbol?.toConstructorCall()
private fun annotationSymbolById(id: ClassId): IrClassSymbol? =
provider?.getClassSymbolById(id) ?: session.symbolProvider.getClassLikeSymbolByClassId(id)?.toSymbol(
session, classifierStorage, ConversionTypeContext.DEFAULT
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.fir.backend
import org.jetbrains.kotlin.fir.declarations.getAnnotationsByClassId
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
import org.jetbrains.kotlin.fir.expressions.classId
import org.jetbrains.kotlin.fir.languageVersionSettings
@@ -121,6 +122,13 @@ class Fir2IrTypeConverter(
typeAnnotations += it
}
}
isExtensionFunctionType -> {
if (annotations.getAnnotationsByClassId(StandardClassIds.Annotations.ExtensionFunctionType).isEmpty()) {
builtIns.extensionFunctionTypeAnnotationConstructorCall()?.let {
typeAnnotations += it
}
}
}
hasFlexibleNullability -> {
builtIns.flexibleNullabilityAnnotationConstructorCall()?.let {
typeAnnotations += it