[Analysis API FIR, LL FIR] use exceptionWithAttachment to not leak user data

This commit is contained in:
Ilya Kirillov
2022-07-23 15:59:30 +02:00
parent b701c1c6f6
commit 827c262f68
25 changed files with 351 additions and 79 deletions
@@ -5,8 +5,12 @@
package org.jetbrains.kotlin.analysis.utils.errors
import org.jetbrains.kotlin.utils.errorWithAttachment
public fun unexpectedElementError(elementName: String, element: Any?): Nothing {
error("Unexpected $elementName ${element?.let { it::class.simpleName }}")
errorWithAttachment("Unexpected $elementName ${element?.let { it::class.simpleName }}") {
withAttachment("element", element)
}
}
public inline fun <reified ELEMENT> unexpectedElementError(element: Any?): Nothing {