Fix SOE from UAST in containsLocalType

containsLocalType now properly handles start projections
#KT-16680 Fixed
This commit is contained in:
Vyacheslav Gerasimov
2017-03-10 15:46:50 +03:00
parent 4e98394c38
commit 830bf62d94
4 changed files with 17 additions and 5 deletions
@@ -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 {
+4
View File
@@ -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")
}