[FIR] Add ability to safe proper ConeKotlinType in FirErrorTypeRef

This is needed for cases when some type ref is resolved to proper type
  but has some diagnostic (e.g. this type is invisible)
This commit is contained in:
Dmitriy Novozhilov
2021-11-23 16:05:49 +03:00
committed by teamcityserver
parent 08b0e17d47
commit f2c319c4ae
10 changed files with 40 additions and 32 deletions
@@ -254,10 +254,6 @@ object BuilderConfigurator : AbstractBuilderConfigurator<FirTreeBuilder>(FirTree
withCopy()
}
builder(errorTypeRef) {
withCopy()
}
builder(functionTypeRef) {
withCopy()
}
@@ -200,15 +200,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
}
}
val errorTypeRefImpl = impl(errorTypeRef) {
default("type", "ConeClassErrorType(diagnostic)")
default("annotations", "mutableListOf()")
useTypes(coneClassErrorTypeType)
default("delegatedTypeRef") {
needAcceptAndTransform = false
}
}
noImpl(errorTypeRef)
impl(property) {
default("isVal") {
@@ -231,7 +223,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
withGetter = true
)
default("returnTypeRef", "FirErrorTypeRefImpl(null, null, diagnostic)")
useTypes(errorTypeRefImpl)
useTypes(errorTypeRefImplType)
}
impl(field) {
@@ -428,13 +420,13 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
impl(errorExpression) {
default("typeRef", "FirErrorTypeRefImpl(source, null, ConeStubDiagnostic(diagnostic))")
useTypes(errorTypeRefImpl, coneStubDiagnosticType)
useTypes(errorTypeRefImplType, coneStubDiagnosticType)
}
impl(errorFunction) {
defaultNull("receiverTypeRef", "body", withGetter = true)
default("returnTypeRef", "FirErrorTypeRefImpl(null, null, diagnostic)")
useTypes(errorTypeRefImpl)
useTypes(errorTypeRefImplType)
}
impl(functionTypeRef)
@@ -98,4 +98,5 @@ val deprecationsPerUseSiteType = type("fir.declarations", "DeprecationsPerUseSit
val emptyAnnotationArgumentMappingType = type("fir.expressions.impl", "FirEmptyAnnotationArgumentMapping")
val firPropertySymbolType = type("fir.symbols.impl", "FirPropertySymbol")
val errorTypeRefImplType = type("fir.types.impl", "FirErrorTypeRefImpl")