Kapt: Return substituted supertypes in directSupertypes() for immediate class types (KT-13746)
(cherry picked from commit 3aae990) (cherry picked from commit 198115b)
This commit is contained in:
committed by
Yan Zhulanow
parent
8d2a4c3f91
commit
f7f8cff00d
+7
-1
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.annotation.processing.impl
|
||||
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.impl.source.PsiImmediateClassType
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.util.*
|
||||
import org.jetbrains.kotlin.java.model.JeElement
|
||||
@@ -124,7 +125,12 @@ class KotlinTypes(val javaPsiFacade: JavaPsiFacade, val psiManager: PsiManager,
|
||||
}
|
||||
|
||||
override fun directSupertypes(t: TypeMirror): List<TypeMirror> {
|
||||
if (t is NoType) throw IllegalArgumentException("Invalid type: $t")
|
||||
if (t is NoType || t is ExecutableType) throw IllegalArgumentException("Invalid type: $t")
|
||||
|
||||
if (t is JeDeclaredType && t.psiType is PsiImmediateClassType) {
|
||||
return t.psiClass.superTypes.map { it.toJeType(psiManager) }
|
||||
}
|
||||
|
||||
val psiType = (t as? JePsiType)?.psiType as? PsiClassType ?: return emptyList()
|
||||
return psiType.superTypes.map { it.toJeType(psiManager) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user