diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/binding/CodegenAnnotatingVisitor.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/binding/CodegenAnnotatingVisitor.java index 282035414cf..168f5b38e88 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/binding/CodegenAnnotatingVisitor.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/binding/CodegenAnnotatingVisitor.java @@ -373,11 +373,13 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid { if (!resolvedCall.getValueArguments().isEmpty()) return true; KotlinType callableReferenceType = bindingContext.getType(expression); - assert callableReferenceType != null : "No type for callable reference: " + expression.getText(); - KotlinType callableReferenceReturnType = CollectionsKt.last(callableReferenceType.getArguments()).getType(); - KotlinType functionReturnType = functionDescriptor.getReturnType(); - assert functionReturnType != null : "No return type for function: " + functionDescriptor; - return KotlinBuiltIns.isUnit(callableReferenceReturnType) && !KotlinBuiltIns.isUnit(functionReturnType); + if (callableReferenceType != null) { + KotlinType callableReferenceReturnType = CollectionsKt.last(callableReferenceType.getArguments()).getType(); + KotlinType functionReturnType = functionDescriptor.getReturnType(); + return functionReturnType != null && + KotlinBuiltIns.isUnit(callableReferenceReturnType) && !KotlinBuiltIns.isUnit(functionReturnType); + } + return false; } @Override