Fix attribute clash between STATIC_INLINE_CLASS_REPLACEMENT and original

Attributes are used to name continuation classes and are generated
before inline classes processing. During the processing, for override
functions in inlined classes, the compiler generates
STATIC_INLINE_CLASS_REPLACEMENT function with body of the override.
The override's body is replaced with delegating call to
STATIC_INLINE_CLASS_REPLACEMENT. However, since we need to keep the name
of the continuation class, we copy attributes from the override to
STATIC_INLINE_CLASS_REPLACEMENT. This leads to attribute clash during
AddContinuationLowering.
So, to fix the issue, do not use the attribute of
STATIC_INLINE_CLASS_REPLACEMENT in original->suspend map.
As an optimization, do not generate continuation for the override
function.
This commit is contained in:
Ilmir Usmanov
2020-05-12 20:28:29 +02:00
parent d2a691d157
commit 0acaedef92
9 changed files with 71 additions and 2 deletions
@@ -7594,6 +7594,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/coroutines/featureIntersection/interfaceMethodWithBodyGeneric.kt");
}
@TestMetadata("overrideInInlineClass.kt")
public void testOverrideInInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/featureIntersection/overrideInInlineClass.kt");
}
@TestMetadata("safeCallOnTwoReceiversLong.kt")
public void testSafeCallOnTwoReceiversLong_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt", "kotlin.coroutines.experimental");