[Analysis API] separate non-class error types from class error types and add information about type qualifiers

it's needed for type printing in renderer
This commit is contained in:
Ilya Kirillov
2022-10-14 15:35:03 +02:00
parent 210212c284
commit 725ae1fc65
35 changed files with 510 additions and 83 deletions
@@ -16,7 +16,7 @@ import com.intellij.psi.search.SearchScope
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.lifetime.isValid
import org.jetbrains.kotlin.analysis.api.symbols.KtTypeParameterSymbol
import org.jetbrains.kotlin.analysis.api.types.KtClassErrorType
import org.jetbrains.kotlin.analysis.api.types.KtErrorType
import org.jetbrains.kotlin.analysis.api.types.KtNonErrorClassType
import org.jetbrains.kotlin.analysis.api.types.KtTypeMappingMode
import org.jetbrains.kotlin.asJava.classes.KotlinSuperTypeListBuilder
@@ -67,7 +67,7 @@ internal class SymbolLightTypeParameter(
.filter { type ->
when (type) {
is KtNonErrorClassType -> type.classId != StandardClassIds.Any
is KtClassErrorType -> false
is KtErrorType -> false
else -> true
}
}
@@ -181,7 +181,7 @@ internal fun KtAnalysisSession.getTypeNullability(ktType: KtType): NullabilityTy
}
if (ktType !is KtNonErrorClassType) return NullabilityType.NotNull
if (ktType.typeArguments.any { it.type is KtClassErrorType }) return NullabilityType.NotNull
if (ktType.ownTypeArguments.any { it.type is KtClassErrorType }) return NullabilityType.NotNull
if (ktType.classId.shortClassName.asString() == SpecialNames.ANONYMOUS_STRING) return NullabilityType.NotNull
val canonicalSignature = ktType.mapTypeToJvmType().descriptor