Add additional diagnostic for EA-225967

This commit is contained in:
Yan Zhulanow
2020-03-03 15:24:15 +09:00
parent 36f3ff7d20
commit 38b6b73745
@@ -45,6 +45,7 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.*
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.expressions.*
import org.jetbrains.kotlin.types.model.TypeSystemInferenceExtensionContext
import org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
import java.util.*
@@ -548,6 +549,11 @@ class PSICallResolver(
assert(externalLambdaArguments.isEmpty()) {
"Unexpected lambda parameters for call $oldCall"
}
if (allValueArguments.isEmpty()) {
throw KotlinExceptionWithAttachments("Can not find an external argument for 'set' method")
.withAttachment("callElement.kt", oldCall.callElement.text)
.withAttachment("file.kt", oldCall.callElement.takeIf { it.isValid }?.containingFile?.text ?: "<no file>")
}
allValueArguments.last()
} else {
if (externalLambdaArguments.size > 1) {