From 0c24f67c21872d394b4c32d0201e33f3ded29005 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Mon, 21 Feb 2022 13:41:59 +0300 Subject: [PATCH] Native: fix location offsets in SuspendFunctionN implementations When generating synthetic Function{N+1}.invoke implementations for SuspendFunction{N} subclasses, use SYNTHETIC_OFFSET instead of suspend invoke function location offsets. This location is more suitable for generated synthetic functions. Additionally, this fixes the case when suspend invoke is fake override: fake overrides use UNDEFINED_OFFSET, so the generated function was getting UNDEFINED_OFFSET as well, leading to incorrect debug information. Fix suspendFunctionAsSupertype.kt and suspendFunctionAsSupertypeCall.kt --- .../backend/common/lower/AbstractSuspendFunctionsLowering.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/AbstractSuspendFunctionsLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/AbstractSuspendFunctionsLowering.kt index 0c0db54a20a..b6edf3894d1 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/AbstractSuspendFunctionsLowering.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/AbstractSuspendFunctionsLowering.kt @@ -110,8 +110,8 @@ abstract class AbstractSuspendFunctionsLowering(val co clazz.superTypes += functionType context.irFactory.buildFun { - startOffset = invokeFunction.startOffset - endOffset = invokeFunction.endOffset + startOffset = SYNTHETIC_OFFSET + endOffset = SYNTHETIC_OFFSET origin = DECLARATION_ORIGIN_COROUTINE_IMPL name = OperatorNameConventions.INVOKE visibility = DescriptorVisibilities.PROTECTED