Kapt: Allow passing primitive types and void to erasure() (KT-13617)

(cherry picked from commit 91444c5)
This commit is contained in:
Yan Zhulanow
2016-08-29 17:25:37 +03:00
committed by Yan Zhulanow
parent 3f2f79ef59
commit cc7eaeb910
3 changed files with 18 additions and 3 deletions
@@ -102,9 +102,11 @@ class KotlinTypes(val javaPsiFacade: JavaPsiFacade, val psiManager: PsiManager,
override fun getPrimitiveType(kind: TypeKind) = kind.toJePrimitiveType()
override fun erasure(t: TypeMirror): TypeMirror {
if (t is NoType) throw IllegalArgumentException("Invalid type: $t")
t as? JePsiType ?: return t
return TypeConversionUtil.erasure(t.psiType).toJeType(psiManager)
if (t.kind == TypeKind.PACKAGE) throw IllegalArgumentException("Invalid type: $t")
return when (t) {
is JePsiType -> TypeConversionUtil.erasure(t.psiType).toJeType(psiManager)
else -> t
}
}
override fun directSupertypes(t: TypeMirror): List<TypeMirror> {