[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
@@ -107,6 +107,7 @@ class FirCallCompletionResultsWriterTransformer(
} else {
buildErrorTypeRef {
source = calculated.source?.fakeElement(KtFakeSourceElementKind.ImplicitTypeRef)
type = calculated.type
diagnostic = calculated.diagnostic
}
}
@@ -116,6 +116,9 @@ class FirSpecificTypeResolverTransformer(
} else {
buildErrorTypeRef {
source = functionTypeRef.source
if (resolvedType != null) {
type = resolvedType
}
diagnostic = (resolvedType as? ConeClassErrorType)?.diagnostic
?: ConeSimpleDiagnostic("Unresolved functional type: ${functionTypeRef.render()}")
}
@@ -146,9 +149,9 @@ class FirSpecificTypeResolverTransformer(
typeRef.source
}
delegatedTypeRef = typeRef
diagnostic = resolvedType.diagnostic
delegatedTypeRef = typeRef
type = resolvedType
diagnostic = resolvedType.diagnostic
}
}
}