diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index a15a41e157d..8e60ed37c61 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -2690,7 +2690,7 @@ public class ExpressionCodegen extends KtVisitor impleme SuspensionPointKind suspensionPointKind = CoroutineCodegenUtilKt.isSuspensionPoint(resolvedCall, this, state.getLanguageVersionSettings()); - boolean maybeSuspensionPoint = suspensionPointKind != SuspensionPointKind.NEVER; + boolean maybeSuspensionPoint = suspensionPointKind != SuspensionPointKind.NEVER && !insideCallableReference(); boolean isConstructor = resolvedCall.getResultingDescriptor() instanceof ConstructorDescriptor; if (!(callableMethod instanceof IntrinsicWithSpecialReceiver)) { putReceiverAndInlineMarkerIfNeeded(callableMethod, resolvedCall, receiver, maybeSuspensionPoint, isConstructor); @@ -2755,6 +2755,11 @@ public class ExpressionCodegen extends KtVisitor impleme } } + private boolean insideCallableReference() { + return (parentCodegen instanceof ClosureCodegen) && + ((ClosureCodegen) parentCodegen).superClassAsmType.equals(FUNCTION_REFERENCE_IMPL); + } + private void putReceiverAndInlineMarkerIfNeeded( @NotNull Callable callableMethod, @NotNull ResolvedCall resolvedCall,