Debugger: Forbid 'Nothing' constructor calls in evaluated code (KT-33093)
This commit is contained in:
+4
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.debugger.evaluate.compilation
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||
import org.jetbrains.kotlin.codegen.getCallLabelForLambdaArgument
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
@@ -196,6 +197,9 @@ class CodeFragmentParameterAnalyzer(
|
||||
evaluationStatus.error(EvaluationError.SuspendCall)
|
||||
throw EvaluateExceptionUtil.createEvaluateException("Evaluation of 'suspend' calls is not supported")
|
||||
}
|
||||
if (descriptor is ConstructorDescriptor && KotlinBuiltIns.isNothing(descriptor.returnType)) {
|
||||
throw EvaluateExceptionUtil.createEvaluateException("'Nothing' can't be instantiated")
|
||||
}
|
||||
}
|
||||
|
||||
return super.visitCallExpression(expression, data)
|
||||
|
||||
Reference in New Issue
Block a user