Use KotlinLightReferenceListBuilder for type parameters bounds

It doesn't run resolve() on freshly added reference, thus the latter is
not failing in recursive case like T : Enum<T>
This commit is contained in:
Denis Zharkov
2018-11-01 14:47:55 +03:00
parent a4cc67d0a0
commit 234776820b
@@ -40,7 +40,8 @@ internal fun buildTypeParameterList(
for ((i, ktParam) in declaration.typeParameters.withIndex()) {
tpList.addParameter(object : LightTypeParameterBuilder(ktParam.name.orEmpty(), owner, i) {
private val superList: LightReferenceListBuilder by lazyPub {
val boundList = LightReferenceListBuilder(manager, PsiReferenceList.Role.EXTENDS_BOUNDS_LIST)
val boundList =
KotlinLightReferenceListBuilder(manager, PsiReferenceList.Role.EXTENDS_BOUNDS_LIST)
if (ktParam.extendsBound != null || declaration.typeConstraints.isNotEmpty()) {
val boundTypes = (ktParam.resolve() as? TypeParameterDescriptor)?.upperBounds.orEmpty()
.mapNotNull { it.asPsiType(ktParam, support, TypeMappingMode.DEFAULT, this) as? PsiClassType }