FIR: do not try to calculate annotation call type

Annotation type is used instead
This commit is contained in:
Mikhail Glukhikh
2019-06-17 14:00:45 +03:00
parent ca401cb01d
commit 65d14ff097
6 changed files with 21 additions and 15 deletions
@@ -858,7 +858,6 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn
}
override fun transformAnnotationCall(annotationCall: FirAnnotationCall, data: Any?): CompositeTransformResult<FirStatement> {
annotationCall.resultType = annotationCall.annotationTypeRef
return (annotationCall.transformChildren(this, data) as FirStatement).compose()
}
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.fir.expressions
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.expressions.impl.FirUnknownTypeCallWithArgumentList
import org.jetbrains.kotlin.fir.expressions.impl.FirCallWithArgumentList
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
import org.jetbrains.kotlin.fir.types.FirTypeRef
@@ -19,7 +19,7 @@ import org.jetbrains.kotlin.name.FqName
abstract class FirAnnotationCall(
session: FirSession,
psi: PsiElement?
) : FirUnknownTypeCallWithArgumentList(session, psi) {
) : FirCallWithArgumentList(session, psi) {
abstract val annotationTypeRef: FirTypeRef
// May be should be not-null (with correct default target)
@@ -20,6 +20,13 @@ class FirAnnotationCallImpl(
override val useSiteTarget: AnnotationUseSiteTarget?,
override var annotationTypeRef: FirTypeRef
) : FirAnnotationCall(session, psi) {
override val typeRef: FirTypeRef
get() = annotationTypeRef
override fun replaceTypeRef(newTypeRef: FirTypeRef) {
throw AssertionError("Attempt to replace type ref for annotation call")
}
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirElement {
annotationTypeRef = annotationTypeRef.transformSingle(transformer, data)
@@ -196,6 +196,10 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
return transformCall(callWithArgumentList, data)
}
open fun transformAnnotationCall(annotationCall: FirAnnotationCall, data: D): CompositeTransformResult<FirStatement> {
return transformCallWithArgumentList(annotationCall, data)
}
open fun transformDelegatedConstructorCall(delegatedConstructorCall: FirDelegatedConstructorCall, data: D): CompositeTransformResult<FirStatement> {
return transformCallWithArgumentList(delegatedConstructorCall, data)
}
@@ -220,10 +224,6 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
return transformCallWithArgumentList(unknownTypeCallWithArgumentList, data)
}
open fun transformAnnotationCall(annotationCall: FirAnnotationCall, data: D): CompositeTransformResult<FirStatement> {
return transformUnknownTypeCallWithArgumentList(annotationCall, data)
}
open fun transformArrayOfCall(arrayOfCall: FirArrayOfCall, data: D): CompositeTransformResult<FirStatement> {
return transformUnknownTypeCallWithArgumentList(arrayOfCall, data)
}
@@ -196,6 +196,10 @@ abstract class FirVisitor<out R, in D> {
return visitCall(callWithArgumentList, data)
}
open fun visitAnnotationCall(annotationCall: FirAnnotationCall, data: D): R {
return visitCallWithArgumentList(annotationCall, data)
}
open fun visitDelegatedConstructorCall(delegatedConstructorCall: FirDelegatedConstructorCall, data: D): R {
return visitCallWithArgumentList(delegatedConstructorCall, data)
}
@@ -220,10 +224,6 @@ abstract class FirVisitor<out R, in D> {
return visitCallWithArgumentList(unknownTypeCallWithArgumentList, data)
}
open fun visitAnnotationCall(annotationCall: FirAnnotationCall, data: D): R {
return visitUnknownTypeCallWithArgumentList(annotationCall, data)
}
open fun visitArrayOfCall(arrayOfCall: FirArrayOfCall, data: D): R {
return visitUnknownTypeCallWithArgumentList(arrayOfCall, data)
}
@@ -196,6 +196,10 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
visitCall(callWithArgumentList, null)
}
open fun visitAnnotationCall(annotationCall: FirAnnotationCall) {
visitCallWithArgumentList(annotationCall, null)
}
open fun visitDelegatedConstructorCall(delegatedConstructorCall: FirDelegatedConstructorCall) {
visitCallWithArgumentList(delegatedConstructorCall, null)
}
@@ -220,10 +224,6 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
visitCallWithArgumentList(unknownTypeCallWithArgumentList, null)
}
open fun visitAnnotationCall(annotationCall: FirAnnotationCall) {
visitUnknownTypeCallWithArgumentList(annotationCall, null)
}
open fun visitArrayOfCall(arrayOfCall: FirArrayOfCall) {
visitUnknownTypeCallWithArgumentList(arrayOfCall, null)
}