diff --git a/compiler/util/src/org/jetbrains/kotlin/utils/KotlinExceptionWithAttachments.kt b/compiler/util/src/org/jetbrains/kotlin/utils/KotlinExceptionWithAttachments.kt index ba64e8a34ad..d9697ccc25d 100644 --- a/compiler/util/src/org/jetbrains/kotlin/utils/KotlinExceptionWithAttachments.kt +++ b/compiler/util/src/org/jetbrains/kotlin/utils/KotlinExceptionWithAttachments.kt @@ -13,7 +13,11 @@ open class KotlinExceptionWithAttachments : RuntimeException, ExceptionWithAttac constructor(message: String) : super(message) - constructor(message: String?, cause: Throwable?) : super(message, cause) + constructor(message: String?, cause: Throwable?) : super(message, cause) { + if (cause is KotlinExceptionWithAttachments) { + attachments.addAll(cause.attachments) + } + } override fun getAttachments(): Array = attachments.toTypedArray() diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ResolutionFacadeWithDebugInfo.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ResolutionFacadeWithDebugInfo.kt index 92e3845f3b8..24f34240e33 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ResolutionFacadeWithDebugInfo.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ResolutionFacadeWithDebugInfo.kt @@ -118,6 +118,9 @@ private class KotlinIdeaResolutionException( appendln("---------------------------------------------") append(creationPlace.description()) }) + for (element in resolvingWhat.elements.withIndex()) { + withAttachment("element${element.index}.kt", element.value.text) + } } } @@ -142,7 +145,7 @@ private class CreationPlace( } private class ResolvingWhat( - private val elements: Collection = emptyList(), + val elements: Collection = emptyList(), private val bodyResolveMode: BodyResolveMode? = null, private val serviceClass: Class<*>? = null, private val moduleDescriptor: ModuleDescriptor? = null