[FIR] KT-46483: Forbid annotations in where Clauses

Merge-request: KT-MR-7208
Merged-by: Nikolay Lunyak <lunyak.kolya@mail.ru>
This commit is contained in:
Nikolay Lunyak
2022-09-28 13:38:18 +00:00
committed by Space
parent a20ce06102
commit f578381726
37 changed files with 462 additions and 20 deletions
@@ -122,6 +122,14 @@ object BuilderConfigurator : AbstractBuilderConfigurator<FirTreeBuilder>(FirTree
useTypes(emptyArgumentListType, emptyAnnotationArgumentMappingType, implicitTypeRefType)
}
builder(errorAnnotationCall) {
parents += callBuilder
default("argumentList", "FirEmptyArgumentList")
default("argumentMapping", "FirEmptyAnnotationArgumentMapping")
default("annotationTypeRef", "FirImplicitTypeRefImpl(null)")
useTypes(emptyArgumentListType, emptyAnnotationArgumentMappingType, implicitTypeRefType)
}
builder(arrayOfCall) {
parents += callBuilder
}
@@ -94,6 +94,7 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
val annotation by element(Expression, expression)
val annotationCall by element(Expression, annotation, call, resolvable)
val annotationArgumentMapping by element(Expression)
val errorAnnotationCall by element(Expression, annotationCall, diagnosticHolder)
val comparisonExpression by element(Expression, expression)
val typeOperatorCall by element(Expression, expression, call)
val assignmentOperatorStatement by element(Expression, statement)
@@ -96,6 +96,13 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
}
}
impl(errorAnnotationCall) {
commonAnnotationConfig()
default("argumentMapping") {
needAcceptAndTransform = false
}
}
impl(arrayOfCall)
impl(callableReferenceAccess)
@@ -469,6 +469,10 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
+field("argumentMapping", annotationArgumentMapping, withReplace = true)
}
errorAnnotationCall.configure {
+field("argumentMapping", annotationArgumentMapping, withReplace = true)
}
annotationArgumentMapping.configure {
+field("mapping", type("Map") to listOf(nameType, expression))
}