Fix exception on attempt to map inner non-fixed type variable
#KT-31842 Fixed
This commit is contained in:
+2
-1
@@ -63,6 +63,7 @@ import org.jetbrains.kotlin.synthetic.SamAdapterExtensionFunctionDescriptor
|
||||
import org.jetbrains.kotlin.type.MapPsiToAsmDesc
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.typeUtil.builtIns
|
||||
import org.jetbrains.kotlin.types.typeUtil.contains
|
||||
import org.jetbrains.kotlin.types.typeUtil.isInterface
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
import org.jetbrains.uast.*
|
||||
@@ -235,7 +236,7 @@ internal fun KotlinType.toPsiType(lightDeclaration: PsiModifierListOwner?, conte
|
||||
return typeAlias.expandedType.toPsiType(lightDeclaration, context, boxed)
|
||||
}
|
||||
|
||||
if (constructor is TypeVariableTypeConstructor) {
|
||||
if (contains { type -> type.constructor is TypeVariableTypeConstructor }) {
|
||||
return UastErrorType
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class Some<T : Some<T>>
|
||||
fun test(list: List<Any>) {
|
||||
list.filterIsInstance<Some>().mapTo(mutableSetOf()) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
UFile (package = ) [public final class InnerNonFixedTypeVariableKt {...]
|
||||
UClass (name = InnerNonFixedTypeVariableKt) [public final class InnerNonFixedTypeVariableKt {...}]
|
||||
UAnnotationMethod (name = test) [public static final fun test(@org.jetbrains.annotations.NotNull list: java.util.List<? extends java.lang.Object>) : void {...}]
|
||||
UParameter (name = list) [@org.jetbrains.annotations.NotNull var list: java.util.List<? extends java.lang.Object>]
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
|
||||
UBlockExpression [{...}] : PsiType:<ErrorType>
|
||||
UQualifiedReferenceExpression [list.filterIsInstance().<ERROR FUNCTION>(mutableSetOf(), { ...})] : PsiType:<ErrorType>
|
||||
UQualifiedReferenceExpression [list.filterIsInstance()]
|
||||
USimpleNameReferenceExpression (identifier = list) [list] : PsiType:List<? extends Object>
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [filterIsInstance()]
|
||||
UIdentifier (Identifier (filterIsInstance)) [UIdentifier (Identifier (filterIsInstance))]
|
||||
USimpleNameReferenceExpression (identifier = filterIsInstance, resolvesTo = null) [filterIsInstance]
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [<ERROR FUNCTION>(mutableSetOf(), { ...})] : PsiType:<ErrorType>
|
||||
UIdentifier (Identifier (mapTo)) [UIdentifier (Identifier (mapTo))]
|
||||
USimpleNameReferenceExpression (identifier = <ERROR FUNCTION>, resolvesTo = null) [<ERROR FUNCTION>] : PsiType:<ErrorType>
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [mutableSetOf()] : PsiType:<ErrorType>
|
||||
UIdentifier (Identifier (mutableSetOf)) [UIdentifier (Identifier (mutableSetOf))]
|
||||
USimpleNameReferenceExpression (identifier = mutableSetOf, resolvesTo = null) [mutableSetOf] : PsiType:<ErrorType>
|
||||
ULambdaExpression [{ ...}] : PsiType:Function0<? extends Unit>
|
||||
UBlockExpression [{...}]
|
||||
UClass (name = Some) [public final class Some {...}]
|
||||
UAnnotationMethod (name = Some) [public fun Some() = UastEmptyExpression]
|
||||
@@ -16,4 +16,6 @@ class KotlinUastTypesTest : AbstractKotlinTypesTest() {
|
||||
@Test fun testStringTemplateComplex() = doTest("StringTemplateComplex")
|
||||
|
||||
@Test fun testInferenceInsideUnresolvedConstructor() = doTest("InferenceInsideUnresolvedConstructor")
|
||||
|
||||
@Test fun testInnerNonFixedTypeVariable() = doTest("InnerNonFixedTypeVariable")
|
||||
}
|
||||
Reference in New Issue
Block a user