[Analysis API] Fix Unexpected FirClassLikeSymbol null for class org.jetbrains.kotlin.fir.types.ConeClassLikeErrorLookupTag exception
on calling `asPsiType` on an unresolved type with type arguments ^KT-65550 fixed
This commit is contained in:
committed by
Space Team
parent
50d526fe91
commit
d925d3be76
+6
@@ -64,6 +64,12 @@ public class FirIdeDependentAnalysisSourceModuleAnalysisApiExpressionPsiTypeProv
|
|||||||
runTest("analysis/analysis-api/testData/components/psiTypeProvider/psiType/forExpression/class_object_constructor.kt");
|
runTest("analysis/analysis-api/testData/components/psiTypeProvider/psiType/forExpression/class_object_constructor.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("errorType.kt")
|
||||||
|
public void testErrorType() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/psiTypeProvider/psiType/forExpression/errorType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("KTIJ25461.kt")
|
@TestMetadata("KTIJ25461.kt")
|
||||||
public void testKTIJ25461() throws Exception {
|
public void testKTIJ25461() throws Exception {
|
||||||
|
|||||||
+6
@@ -64,6 +64,12 @@ public class FirIdeNormalAnalysisSourceModuleAnalysisApiExpressionPsiTypeProvide
|
|||||||
runTest("analysis/analysis-api/testData/components/psiTypeProvider/psiType/forExpression/class_object_constructor.kt");
|
runTest("analysis/analysis-api/testData/components/psiTypeProvider/psiType/forExpression/class_object_constructor.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("errorType.kt")
|
||||||
|
public void testErrorType() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/psiTypeProvider/psiType/forExpression/errorType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("KTIJ25461.kt")
|
@TestMetadata("KTIJ25461.kt")
|
||||||
public void testKTIJ25461() throws Exception {
|
public void testKTIJ25461() throws Exception {
|
||||||
|
|||||||
+6
@@ -64,6 +64,12 @@ public class FirStandaloneNormalAnalysisSourceModuleAnalysisApiExpressionPsiType
|
|||||||
runTest("analysis/analysis-api/testData/components/psiTypeProvider/psiType/forExpression/class_object_constructor.kt");
|
runTest("analysis/analysis-api/testData/components/psiTypeProvider/psiType/forExpression/class_object_constructor.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("errorType.kt")
|
||||||
|
public void testErrorType() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/components/psiTypeProvider/psiType/forExpression/errorType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("KTIJ25461.kt")
|
@TestMetadata("KTIJ25461.kt")
|
||||||
public void testKTIJ25461() throws Exception {
|
public void testKTIJ25461() throws Exception {
|
||||||
|
|||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fun foo(x: UNRESOLVED<Nothing>) {
|
||||||
|
<expr>x</expr>
|
||||||
|
}
|
||||||
Vendored
+97
@@ -0,0 +1,97 @@
|
|||||||
|
KtType: UNRESOLVED<kotlin.Nothing>
|
||||||
|
asPsiType(allowErrorTypes=false, mode=DEFAULT, isAnnotationMethod=false):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=DEFAULT, isAnnotationMethod=true):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=DEFAULT_UAST, isAnnotationMethod=false):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=DEFAULT_UAST, isAnnotationMethod=true):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=GENERIC_ARGUMENT, isAnnotationMethod=false):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=GENERIC_ARGUMENT, isAnnotationMethod=true):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=SUPER_TYPE, isAnnotationMethod=false):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=SUPER_TYPE, isAnnotationMethod=true):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=SUPER_TYPE_KOTLIN_COLLECTIONS_AS_IS, isAnnotationMethod=false):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=SUPER_TYPE_KOTLIN_COLLECTIONS_AS_IS, isAnnotationMethod=true):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=RETURN_TYPE_BOXED, isAnnotationMethod=false):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=RETURN_TYPE_BOXED, isAnnotationMethod=true):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=RETURN_TYPE, isAnnotationMethod=false):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=RETURN_TYPE, isAnnotationMethod=true):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=VALUE_PARAMETER, isAnnotationMethod=false):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=false, mode=VALUE_PARAMETER, isAnnotationMethod=true):
|
||||||
|
null
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=DEFAULT, isAnnotationMethod=false):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=DEFAULT, isAnnotationMethod=true):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=DEFAULT_UAST, isAnnotationMethod=false):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=DEFAULT_UAST, isAnnotationMethod=true):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=GENERIC_ARGUMENT, isAnnotationMethod=false):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=GENERIC_ARGUMENT, isAnnotationMethod=true):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=SUPER_TYPE, isAnnotationMethod=false):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=SUPER_TYPE, isAnnotationMethod=true):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=SUPER_TYPE_KOTLIN_COLLECTIONS_AS_IS, isAnnotationMethod=false):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=SUPER_TYPE_KOTLIN_COLLECTIONS_AS_IS, isAnnotationMethod=true):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=RETURN_TYPE_BOXED, isAnnotationMethod=false):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=RETURN_TYPE_BOXED, isAnnotationMethod=true):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=RETURN_TYPE, isAnnotationMethod=false):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=RETURN_TYPE, isAnnotationMethod=true):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=VALUE_PARAMETER, isAnnotationMethod=false):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
|
asPsiType(allowErrorTypes=true, mode=VALUE_PARAMETER, isAnnotationMethod=true):
|
||||||
|
PsiType:UNRESOLVED<Void>
|
||||||
|
|
||||||
@@ -1426,6 +1426,11 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
|||||||
SimpleClassicTypeSystemContext.hasNothingInNonContravariantPosition(kotlinType)
|
SimpleClassicTypeSystemContext.hasNothingInNonContravariantPosition(kotlinType)
|
||||||
|
|
||||||
fun TypeSystemContext.hasNothingInNonContravariantPosition(type: KotlinTypeMarker): Boolean {
|
fun TypeSystemContext.hasNothingInNonContravariantPosition(type: KotlinTypeMarker): Boolean {
|
||||||
|
if (type.isError()) {
|
||||||
|
// We cannot access type arguments for an unresolved type
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
val typeConstructor = type.typeConstructor()
|
val typeConstructor = type.typeConstructor()
|
||||||
|
|
||||||
for (i in 0 until type.argumentsCount()) {
|
for (i in 0 until type.argumentsCount()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user