[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
@@ -117,6 +117,7 @@ fun FirTypeRef.resolvedTypeFromPrototype(
return if (type is ConeKotlinErrorType) {
buildErrorTypeRef {
source = this@resolvedTypeFromPrototype.source
this.type = type
diagnostic = type.diagnostic
}
} else {
@@ -217,6 +217,7 @@ fun ConeKotlinType.toFirResolvedTypeRef(
buildErrorTypeRef {
this.source = source
diagnostic = this@toFirResolvedTypeRef.diagnostic
type = this@toFirResolvedTypeRef
this.delegatedTypeRef = delegatedTypeRef
}
} else {
@@ -275,6 +276,7 @@ fun FirTypeRef.withReplacedConeType(
return if (newType is ConeKotlinErrorType) {
buildErrorTypeRef {
source = newSource
type = newType
diagnostic = newType.diagnostic
}
} else {