Optimize exception messages to contain helpful debug information
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/utils.kt b/api/src/main/kotlin/com/google/devtools/ksp/utils.kt
index 2aaf52b..3b61618 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/utils.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/utils.kt
@@ -132,7 +132,7 @@
is KSClassDeclaration -> sequenceOf(resolvedDeclaration)
is KSTypeAlias -> sequenceOf(resolvedDeclaration.findActualType())
is KSTypeParameter -> resolvedDeclaration.getTypesUpperBound()
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("unhandled type parameter bound, $ExceptionMessage")
}
}
@@ -148,7 +148,7 @@
is KSClassDeclaration -> it.getAllSuperTypes()
is KSTypeAlias -> it.findActualType().getAllSuperTypes()
is KSTypeParameter -> it.getTypesUpperBound().flatMap { it.getAllSuperTypes() }
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("unhandled super type kind, $ExceptionMessage")
}
}
)
@@ -243,3 +243,5 @@
}
}
+
+const val ExceptionMessage = "please file a bug at https://github.com/google/ksp/issues/new"
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/visitor/KSValidateVisitor.kt b/api/src/main/kotlin/com/google/devtools/ksp/visitor/KSValidateVisitor.kt
index aef46c9..d28ccb4 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/visitor/KSValidateVisitor.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/visitor/KSValidateVisitor.kt
@@ -1,5 +1,6 @@
package com.google.devtools.ksp.visitor
+import com.google.devtools.ksp.ExceptionMessage
import com.google.devtools.ksp.symbol.*
class KSValidateVisitor(private val predicate: (KSNode, KSNode) -> Boolean) : KSDefaultVisitor<Unit, Boolean>() {
@@ -16,7 +17,7 @@
}
override fun defaultHandler(node: KSNode, data: Unit): Boolean {
- throw IllegalStateException("unhandled validation condition, please file a bug at https://github.com/google/ksp/issues/new")
+ throw IllegalStateException("unhandled validation condition, $ExceptionMessage")
}
override fun visitTypeReference(typeReference: KSTypeReference, data: Unit): Boolean {
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/processing/impl/CodeGeneratorImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/processing/impl/CodeGeneratorImpl.kt
index 792a1af..50797d2 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/processing/impl/CodeGeneratorImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/processing/impl/CodeGeneratorImpl.kt
@@ -46,7 +46,7 @@
val file = File(path)
val parentFile = file.parentFile
if (!parentFile.exists() && !parentFile.mkdirs()) {
- throw IllegalStateException()
+ throw IllegalStateException("failed to make parent directories.")
}
file.writeText("")
fileMap[path] = file
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/processing/impl/ResolverImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/processing/impl/ResolverImpl.kt
index cabf0da..8dd9545 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/processing/impl/ResolverImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/processing/impl/ResolverImpl.kt
@@ -18,10 +18,7 @@
package com.google.devtools.ksp.processing.impl
-import com.google.devtools.ksp.KspExperimental
-import com.google.devtools.ksp.closestClassDeclaration
-import com.google.devtools.ksp.isOpen
-import com.google.devtools.ksp.isVisibleFrom
+import com.google.devtools.ksp.*
import com.intellij.openapi.project.Project
import com.intellij.psi.*
import com.intellij.psi.impl.source.PsiClassReferenceType
@@ -442,7 +439,7 @@
return getKSTypeCached(resolveJavaType(type.psi), type.element.typeArguments, type.annotations)
}
}
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unable to resolve type for $type, $ExceptionMessage")
}
}
@@ -454,13 +451,14 @@
is KtClassOrObject -> KSClassDeclarationImpl.getCached(psi)
is PsiClass -> KSClassDeclarationJavaImpl.getCached(psi)
is KtTypeAlias -> KSTypeAliasImpl.getCached(psi)
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected psi type: ${psi.javaClass}, $ExceptionMessage")
}
} else {
when (descriptor) {
is ClassDescriptor -> KSClassDeclarationDescriptorImpl.getCached(descriptor)
is TypeParameterDescriptor -> KSTypeParameterDescriptorImpl.getCached(descriptor)
- else -> throw IllegalStateException()
+ null -> throw IllegalStateException("Failed to resolve descriptor for $kotlinType")
+ else -> throw IllegalStateException("Unexpected descriptor type: ${descriptor.javaClass}, $ExceptionMessage")
}
}
}
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSAnnotationDescriptorImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSAnnotationDescriptorImpl.kt
index b48c745..5e26b3a 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSAnnotationDescriptorImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSAnnotationDescriptorImpl.kt
@@ -18,6 +18,7 @@
package com.google.devtools.ksp.symbol.impl.binary
+import com.google.devtools.ksp.ExceptionMessage
import com.intellij.psi.JavaPsiFacade
import com.intellij.psi.PsiAnnotationMethod
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
@@ -122,6 +123,6 @@
}
is KtParameter -> ResolverImpl.instance.evaluateConstant(psi.defaultValue, this.type)?.value
is PsiAnnotationMethod -> JavaPsiFacade.getInstance(psi.project).constantEvaluationHelper.computeConstantExpression((psi).defaultValue)
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected psi ${psi.javaClass}, $ExceptionMessage")
}
}
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSClassDeclarationDescriptorImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSClassDeclarationDescriptorImpl.kt
index 24b9ea9..6ab85f8 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSClassDeclarationDescriptorImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSClassDeclarationDescriptorImpl.kt
@@ -18,6 +18,7 @@
package com.google.devtools.ksp.symbol.impl.binary
+import com.google.devtools.ksp.ExceptionMessage
import org.jetbrains.kotlin.descriptors.*
import com.google.devtools.ksp.symbol.*
import com.google.devtools.ksp.symbol.impl.KSObjectCache
@@ -91,7 +92,7 @@
is PropertyDescriptor -> KSPropertyDeclarationDescriptorImpl.getCached(it)
is FunctionDescriptor -> KSFunctionDeclarationDescriptorImpl.getCached(it)
is ClassDescriptor -> getCached(it)
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected descriptor type ${it.javaClass}, $ExceptionMessage")
}
}
}
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSFunctionDeclarationDescriptorImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSFunctionDeclarationDescriptorImpl.kt
index e285add..d08bf63 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSFunctionDeclarationDescriptorImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSFunctionDeclarationDescriptorImpl.kt
@@ -18,6 +18,7 @@
package com.google.devtools.ksp.symbol.impl.binary
+import com.google.devtools.ksp.ExceptionMessage
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor
import com.google.devtools.ksp.isOpen
@@ -31,6 +32,7 @@
import com.google.devtools.ksp.symbol.impl.toKSModifiers
import org.jetbrains.kotlin.load.java.isFromJava
import org.jetbrains.kotlin.resolve.OverridingUtil
+import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
class KSFunctionDeclarationDescriptorImpl private constructor(val descriptor: FunctionDescriptor) : KSFunctionDeclaration,
KSDeclarationDescriptorImpl(descriptor),
@@ -64,7 +66,7 @@
descriptor.dispatchReceiverParameter == null -> if (descriptor.isFromJava) FunctionKind.STATIC else FunctionKind.TOP_LEVEL
!descriptor.name.isSpecial && !descriptor.name.asString().isEmpty() -> FunctionKind.MEMBER
descriptor is AnonymousFunctionDescriptor -> FunctionKind.ANONYMOUS
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unable to resolve FunctionKind for ${descriptor.fqNameSafe}, $ExceptionMessage")
}
}
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSPropertySetterDescriptorImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSPropertySetterDescriptorImpl.kt
index f85ed18..2db6fe9 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSPropertySetterDescriptorImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSPropertySetterDescriptorImpl.kt
@@ -29,7 +29,8 @@
}
override val parameter: KSValueParameter by lazy {
- descriptor.valueParameters.singleOrNull()?.let { KSValueParameterDescriptorImpl.getCached(it) } ?: throw IllegalStateException()
+ descriptor.valueParameters.singleOrNull()?.let { KSValueParameterDescriptorImpl.getCached(it) }
+ ?: throw IllegalStateException("Failed to resolve property type")
}
override fun <D, R> accept(visitor: KSVisitor<D, R>, data: D): R {
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSTypeParameterDescriptorImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSTypeParameterDescriptorImpl.kt
index bbf0242..4297e73 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSTypeParameterDescriptorImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSTypeParameterDescriptorImpl.kt
@@ -18,6 +18,7 @@
package com.google.devtools.ksp.symbol.impl.binary
+import com.google.devtools.ksp.ExceptionMessage
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
@@ -47,7 +48,7 @@
is ClassDescriptor -> KSClassDeclarationDescriptorImpl.getCached(parent)
is FunctionDescriptor -> KSFunctionDeclarationDescriptorImpl.getCached(parent)
is PropertyDescriptor -> KSPropertyDeclarationDescriptorImpl.getCached(parent)
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected containing declaration for ${descriptor.fqNameSafe}, $ExceptionMessage")
}
}
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSTypeReferenceDescriptorImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSTypeReferenceDescriptorImpl.kt
index 8b8a2c6..cb4a84c 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSTypeReferenceDescriptorImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSTypeReferenceDescriptorImpl.kt
@@ -18,6 +18,7 @@
package com.google.devtools.ksp.symbol.impl.binary
+import com.google.devtools.ksp.ExceptionMessage
import org.jetbrains.kotlin.builtins.isSuspendFunctionTypeOrSubtype
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
@@ -44,10 +45,10 @@
when (upperBound) {
is FlexibleType -> KSClassifierReferenceDescriptorImpl.getCached(upperBound.upperBound)
is SimpleType -> KSClassifierReferenceDescriptorImpl.getCached(upperBound)
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected upperbound type ${upperBound.javaClass}, $ExceptionMessage")
}
}
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected type: ${kotlinType.constructor.declarationDescriptor?.javaClass}, $ExceptionMessage")
}
}
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/java/KSTypeReferenceJavaImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/java/KSTypeReferenceJavaImpl.kt
index 94366c6..073967e 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/java/KSTypeReferenceJavaImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/java/KSTypeReferenceJavaImpl.kt
@@ -18,6 +18,7 @@
package com.google.devtools.ksp.symbol.impl.java
+import com.google.devtools.ksp.ExceptionMessage
import com.intellij.psi.*
import com.intellij.psi.impl.source.PsiClassReferenceType
import com.google.devtools.ksp.processing.impl.ResolverImpl
@@ -62,7 +63,7 @@
"char" -> ResolverImpl.instance.module.builtIns.charType
"boolean" -> ResolverImpl.instance.module.builtIns.booleanType
"void" -> ResolverImpl.instance.module.builtIns.unitType
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected primitive type ${this.name}, $ExceptionMessage")
}
}
@@ -88,7 +89,7 @@
}
}
null -> KSClassifierReferenceDescriptorImpl.getCached((ResolverImpl.instance.builtIns.anyType as KSTypeImpl).kotlinType.makeNullable())
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected psi type for ${type.javaClass}, $ExceptionMessage")
}
}
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSFunctionDeclarationImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSFunctionDeclarationImpl.kt
index a0f413a..736da55 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSFunctionDeclarationImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSFunctionDeclarationImpl.kt
@@ -18,6 +18,7 @@
package com.google.devtools.ksp.symbol.impl.kotlin
+import com.google.devtools.ksp.ExceptionMessage
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import com.google.devtools.ksp.isOpen
import com.google.devtools.ksp.isVisibleFrom
@@ -65,7 +66,7 @@
when (ktFunction) {
is KtNamedFunction, is KtPrimaryConstructor, is KtSecondaryConstructor -> FunctionKind.MEMBER
is KtFunctionLiteral -> if (ktFunction.node.findChildByType(KtTokens.FUN_KEYWORD) != null) FunctionKind.ANONYMOUS else FunctionKind.LAMBDA
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected psi type ${ktFunction.javaClass}, $ExceptionMessage")
}
}
}
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSPropertySetterImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSPropertySetterImpl.kt
index c313b8f..ab00501 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSPropertySetterImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSPropertySetterImpl.kt
@@ -30,7 +30,7 @@
override val parameter: KSValueParameter by lazy {
ktPropertySetter.parameterList?.parameters?.singleOrNull()?.let { KSValueParameterImpl.getCached(it) }
- ?: throw IllegalStateException()
+ ?: throw IllegalStateException("Failed to resolve property type")
}
override fun <D, R> accept(visitor: KSVisitor<D, R>, data: D): R {
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSTypeParameterImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSTypeParameterImpl.kt
index e064e1c..980ea12 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSTypeParameterImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSTypeParameterImpl.kt
@@ -18,6 +18,7 @@
package com.google.devtools.ksp.symbol.impl.kotlin
+import com.google.devtools.ksp.ExceptionMessage
import com.google.devtools.ksp.symbol.*
import com.google.devtools.ksp.symbol.impl.KSObjectCache
import com.google.devtools.ksp.symbol.impl.toKSModifiers
@@ -71,7 +72,7 @@
is KtClassOrObject -> KSClassDeclarationImpl.getCached(owner)
is KtFunction -> KSFunctionDeclarationImpl.getCached(owner)
is KtProperty -> KSPropertyDeclarationImpl.getCached(owner)
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected containing declaration type ${owner.javaClass}, $ExceptionMessage")
}
}
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSTypeReferenceImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSTypeReferenceImpl.kt
index 74909da..3bba9e6 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSTypeReferenceImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSTypeReferenceImpl.kt
@@ -18,6 +18,7 @@
package com.google.devtools.ksp.symbol.impl.kotlin
+import com.google.devtools.ksp.ExceptionMessage
import com.google.devtools.ksp.processing.impl.ResolverImpl
import com.google.devtools.ksp.symbol.*
import com.google.devtools.ksp.symbol.impl.KSObjectCache
@@ -53,7 +54,7 @@
is KtFunctionType -> KSCallableReferenceImpl.getCached(typeElement)
is KtUserType -> KSClassifierReferenceImpl.getCached(typeElement)
is KtDynamicType -> KSDynamicReferenceImpl.getCached(Unit)
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected type element ${typeElement?.javaClass}, $ExceptionMessage")
}
}
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/synthetic/KSPropertySetterSyntheticImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/synthetic/KSPropertySetterSyntheticImpl.kt
index 34dfaed..c88977b 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/synthetic/KSPropertySetterSyntheticImpl.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/synthetic/KSPropertySetterSyntheticImpl.kt
@@ -39,7 +39,8 @@
}
override val parameter: KSValueParameter by lazy {
- descriptor.valueParameters.singleOrNull()?.let { KSValueParameterDescriptorImpl.getCached(it) } ?: throw IllegalStateException()
+ descriptor.valueParameters.singleOrNull()?.let { KSValueParameterDescriptorImpl.getCached(it) }
+ ?: throw IllegalStateException("Failed to resolve property type")
}
override fun <D, R> accept(visitor: KSVisitor<D, R>, data: D): R {
diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/utils.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/utils.kt
index 602b00c..ac06d11 100644
--- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/utils.kt
+++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/utils.kt
@@ -18,6 +18,7 @@
package com.google.devtools.ksp.symbol.impl
+import com.google.devtools.ksp.ExceptionMessage
import com.intellij.lang.jvm.JvmModifier
import com.intellij.psi.*
import org.jetbrains.kotlin.descriptors.*
@@ -209,7 +210,7 @@
this.isAnnotation() -> ClassKind.ANNOTATION_CLASS
else -> ClassKind.CLASS
}
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected psi type ${this.javaClass}, $ExceptionMessage")
}
}
@@ -228,7 +229,7 @@
org.jetbrains.kotlin.types.Variance.IN_VARIANCE -> Variance.CONTRAVARIANT
org.jetbrains.kotlin.types.Variance.OUT_VARIANCE -> Variance.COVARIANT
org.jetbrains.kotlin.types.Variance.INVARIANT -> Variance.INVARIANT
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected variance value $this, $ExceptionMessage")
}
}
@@ -246,7 +247,7 @@
val type = when (ksTypeArgument) {
is KSTypeArgumentKtImpl, is KSTypeArgumentJavaImpl, is KSTypeArgumentLiteImpl -> ksTypeArgument.type!!
is KSTypeArgumentDescriptorImpl -> return@mapIndexed ksTypeArgument.descriptor
- else -> throw IllegalStateException()
+ else -> throw IllegalStateException("Unexpected psi for type argument: ${ksTypeArgument.javaClass}, $ExceptionMessage")
}.toKotlinType()
TypeProjectionImpl(variance, type)