[LL FIR] calculate lazy bodies for type annotations
^KT-56543
This commit is contained in:
committed by
Space Team
parent
badd09e4fd
commit
77e1bc6f9e
+15
@@ -18,12 +18,17 @@ import org.jetbrains.kotlin.fir.expressions.impl.FirLazyDelegatedConstructorCall
|
|||||||
import org.jetbrains.kotlin.fir.extensions.registeredPluginAnnotations
|
import org.jetbrains.kotlin.fir.extensions.registeredPluginAnnotations
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.plugin.CompilerRequiredAnnotationsHelper
|
import org.jetbrains.kotlin.fir.resolve.transformers.plugin.CompilerRequiredAnnotationsHelper
|
||||||
import org.jetbrains.kotlin.fir.scopes.kotlinScopeProvider
|
import org.jetbrains.kotlin.fir.scopes.kotlinScopeProvider
|
||||||
|
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
||||||
|
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.FirUserTypeRef
|
import org.jetbrains.kotlin.fir.types.FirUserTypeRef
|
||||||
|
import org.jetbrains.kotlin.fir.types.coneType
|
||||||
import org.jetbrains.kotlin.fir.visitors.FirTransformer
|
import org.jetbrains.kotlin.fir.visitors.FirTransformer
|
||||||
import org.jetbrains.kotlin.fir.visitors.transformSingle
|
import org.jetbrains.kotlin.fir.visitors.transformSingle
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import org.jetbrains.kotlin.name.StandardClassIds.Annotations.SinceKotlin
|
import org.jetbrains.kotlin.name.StandardClassIds.Annotations.SinceKotlin
|
||||||
|
import org.jetbrains.kotlin.fir.types.customAnnotations
|
||||||
|
import org.jetbrains.kotlin.fir.types.forEachType
|
||||||
|
|
||||||
internal object FirLazyBodiesCalculator {
|
internal object FirLazyBodiesCalculator {
|
||||||
fun calculateLazyBodiesInside(designation: FirDesignation) {
|
fun calculateLazyBodiesInside(designation: FirDesignation) {
|
||||||
@@ -223,6 +228,16 @@ private object FirLazyAnnotationTransformer : FirTransformer<FirLazyAnnotationTr
|
|||||||
return element
|
return element
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun transformResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef, data: FirLazyAnnotationTransformerData): FirTypeRef {
|
||||||
|
resolvedTypeRef.coneType.forEachType { coneType ->
|
||||||
|
for (typeArgumentAnnotation in coneType.customAnnotations) {
|
||||||
|
typeArgumentAnnotation.accept(this, data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.transformResolvedTypeRef(resolvedTypeRef, data)
|
||||||
|
}
|
||||||
|
|
||||||
override fun transformAnnotationCall(annotationCall: FirAnnotationCall, data: FirLazyAnnotationTransformerData): FirStatement {
|
override fun transformAnnotationCall(annotationCall: FirAnnotationCall, data: FirLazyAnnotationTransformerData): FirStatement {
|
||||||
val shouldCalculate = data.compilerAnnotationsOnly == FirLazyAnnotationTransformerScope.ALL_ANNOTATIONS ||
|
val shouldCalculate = data.compilerAnnotationsOnly == FirLazyAnnotationTransformerScope.ALL_ANNOTATIONS ||
|
||||||
canBeCompilerAnnotation(annotationCall, data.session)
|
canBeCompilerAnnotation(annotationCall, data.session)
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_REVERSED_RESOLVE
|
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||||
|
|
||||||
annotation class Ann
|
annotation class Ann
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_REVERSED_RESOLVE
|
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||||
|
|
||||||
annotation class Ann
|
annotation class Ann
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_REVERSED_RESOLVE
|
|
||||||
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
|
||||||
class A
|
class A
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_REVERSED_RESOLVE
|
|
||||||
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
|
||||||
class A
|
class A
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user