[compiler] preserve fir receiver in tree

when selector is invalid expression,
ensure that fir tree still contains receiver as well as selector

KTIJ-23578
This commit is contained in:
Anna Kozlova
2022-11-21 15:34:41 +01:00
committed by Space Team
parent 1aae9d6456
commit 3fdd0aacd3
17 changed files with 243 additions and 2 deletions
@@ -116,6 +116,7 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
val errorFunction by element(Declaration, function, diagnosticHolder)
val errorProperty by element(Declaration, variable, diagnosticHolder)
val qualifiedAccessExpression by element(Expression, expression, qualifiedAccess)
val qualifiedErrorAccessExpression by element(Expression, expression, diagnosticHolder)
val propertyAccessExpression by element(Expression, qualifiedAccessExpression)
val functionCall by element(Expression, qualifiedAccessExpression, call)
val integerLiteralOperatorCall by element(Expression, functionCall)
@@ -433,6 +433,11 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
useTypes(errorTypeRefImplType, coneStubDiagnosticType)
}
impl(qualifiedErrorAccessExpression) {
default("typeRef", "FirErrorTypeRefImpl(source, null, ConeStubDiagnostic(diagnostic), false)")
useTypes(errorTypeRefImplType, coneStubDiagnosticType)
}
impl(errorFunction) {
defaultNull("receiverParameter", "body", withGetter = true)
default("returnTypeRef", "FirErrorTypeRefImpl(null, null, diagnostic, false)")
@@ -207,6 +207,11 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
+fieldList("nonFatalDiagnostics", coneDiagnosticType)
}
qualifiedErrorAccessExpression.configure {
+field("selector", errorExpression)
+field("receiver", expression)
}
constExpression.configure {
withArg("T")
+field("kind", constKindType.withArgs("T"), withReplace = true)