Fix SOE from UAST in containsLocalType
containsLocalType now properly handles start projections #KT-16680 Fixed
This commit is contained in:
+1
-5
@@ -109,11 +109,7 @@ private fun KotlinType.containsLocalTypes(): Boolean {
|
||||
}
|
||||
}
|
||||
|
||||
if (arguments.any { it.type.containsLocalTypes() }) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return arguments.any { !it.isStarProjection && it.type.containsLocalTypes() }
|
||||
}
|
||||
|
||||
internal fun KtTypeReference?.toPsiType(source: UElement, boxed: Boolean = false): PsiType {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
class Device<D: Device<D>>
|
||||
|
||||
val a = null as? Device<*>
|
||||
@@ -0,0 +1,10 @@
|
||||
UFile (package = ) [public final class CycleInTypeParametersKt {...]
|
||||
UClass (name = CycleInTypeParametersKt) [public final class CycleInTypeParametersKt {...}]
|
||||
UField (name = a) [private static final var a: Device<?> = null as? Device<?>]
|
||||
UAnnotation (fqName = org.jetbrains.annotations.Nullable) [@org.jetbrains.annotations.Nullable]
|
||||
UBinaryExpressionWithType [null as? Device<?>] : PsiType:Device<?>
|
||||
ULiteralExpression (value = null) [null] : PsiType:Void
|
||||
UTypeReferenceExpression (name = Device<?>) [Device<?>]
|
||||
UAnnotationMethod (name = getA) [public static final fun getA() : Device<?> = UastEmptyExpression]
|
||||
UClass (name = Device) [public final class Device {...}]
|
||||
UAnnotationMethod (name = Device) [public fun Device() = UastEmptyExpression]
|
||||
@@ -6,4 +6,6 @@ class KotlinUastTypesTest : AbstractKotlinTypesTest() {
|
||||
@Test fun testLocalDeclarations() = doTest("LocalDeclarations")
|
||||
|
||||
@Test fun testUnexpectedContainerException() = doTest("UnexpectedContainerException")
|
||||
|
||||
@Test fun testCycleInTypeParameters() = doTest("cycleInTypeParameters")
|
||||
}
|
||||
Reference in New Issue
Block a user