AA: handle erroneous type in nested type argument
This commit is contained in:
committed by
Ilya Kirillov
parent
ac514849f4
commit
fcba1f215a
+7
-2
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.load.kotlin.getOptimalModeForReturnType
|
||||
import org.jetbrains.kotlin.load.kotlin.getOptimalModeForValueParameter
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.model.SimpleTypeMarker
|
||||
import java.text.StringCharacterIterator
|
||||
|
||||
internal class KtFe10PsiTypeProvider(
|
||||
@@ -43,8 +44,10 @@ internal class KtFe10PsiTypeProvider(
|
||||
): PsiType? {
|
||||
val kotlinType = (type as KtFe10Type).type
|
||||
|
||||
if (kotlinType.isError || kotlinType.arguments.any { !it.isStarProjection && it.type.isError }) {
|
||||
return null
|
||||
with(typeMapper.typeContext) {
|
||||
if (kotlinType.contains { it.isError() }) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
return asPsiType(simplifyType(kotlinType), useSitePosition, mode.toTypeMappingMode(type, isAnnotationMethod))
|
||||
@@ -79,6 +82,8 @@ internal class KtFe10PsiTypeProvider(
|
||||
}
|
||||
|
||||
private fun asPsiType(type: KotlinType, useSitePosition: PsiElement, mode: TypeMappingMode): PsiType? {
|
||||
if (type !is SimpleTypeMarker) return null
|
||||
|
||||
val signatureWriter = BothSignatureWriter(BothSignatureWriter.Mode.SKIP_CHECKS)
|
||||
typeMapper.mapType(type, mode, signatureWriter)
|
||||
|
||||
|
||||
+6
@@ -64,6 +64,12 @@ public class Fe10IdeNormalAnalysisSourceModuleAnalysisApiPsiTypeProviderTestGene
|
||||
runTest("analysis/analysis-api/testData/components/psiTypeProvider/psiType/forDeclaration/anonymousObject_exposedAsReturnValue.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("errorTypeInNestedTypeArgument.kt")
|
||||
public void testErrorTypeInNestedTypeArgument() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/psiTypeProvider/psiType/forDeclaration/errorTypeInNestedTypeArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localClass_exposedAsReturnValue.kt")
|
||||
public void testLocalClass_exposedAsReturnValue() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user