Don't assign type parameters from original proto if type is substituted with Any (KT-15128)

#KT-15128 Fixed
This commit is contained in:
Nikolay Krasko
2016-12-16 19:28:06 +03:00
parent e9e1b3fea1
commit c076ad5a8d
5 changed files with 70 additions and 4 deletions
@@ -141,10 +141,12 @@ fun createStubForPackageName(packageDirectiveStub: KotlinPlaceHolderStubImpl<KtP
fun createStubForTypeName(
typeClassId: ClassId,
parent: StubElement<out PsiElement>,
onUserTypeLevel: (KotlinUserTypeStub, Int) -> Unit = { x, y -> }
bindTypeArguments: (KotlinUserTypeStub, Int) -> Unit = { x, y -> }
): KotlinUserTypeStub {
val substituteWithAny = typeClassId.isLocal
val fqName =
if (typeClassId.isLocal) KotlinBuiltIns.FQ_NAMES.any
if (substituteWithAny) KotlinBuiltIns.FQ_NAMES.any
else typeClassId.asSingleFqName().toUnsafe()
val segments = fqName.pathSegments().asReversed()
assert(segments.isNotEmpty())
@@ -156,7 +158,9 @@ fun createStubForTypeName(
recCreateStubForType(userTypeStub, level + 1)
}
KotlinNameReferenceExpressionStubImpl(userTypeStub, lastSegment.ref())
onUserTypeLevel(userTypeStub, level)
if (!substituteWithAny) {
bindTypeArguments(userTypeStub, level)
}
return userTypeStub
}