From 607cf4c86d302e877942e6222f5f3ff7aca6c8e7 Mon Sep 17 00:00:00 2001 From: Michael Bogdanov Date: Fri, 30 Sep 2016 13:52:59 +0300 Subject: [PATCH] Support Nothing return type --- .../kotlin/backend/jvm/codegen/ExpressionCodegen.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index 3a48f0f485f..b967b0cb4b0 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -192,6 +192,11 @@ class ExpressionCodegen( } else { (callable as CallableMethod).genInvokeDefaultInstruction(mv) } + val returnType = expression.descriptor.returnType + if (returnType != null && KotlinBuiltIns.isNothing(returnType)) { + mv.aconst(null) + mv.athrow() + } return StackValue.onStack(callable.returnType) } }