Do not generate $$forInline suffix for enclosing method

in OUTERCLASS field.

The inliner generates two versions of suspend functions/lambdas in
inline functions: with state-machine and without. The former is used
to call the function from Java or via reflection and have ordinary
name, while the latter is used by inliner and have $$forInline suffix.
The inliner throws the state-machine version away, duplicates
$$forInline version and then call state-machine generator.

If these suspend functions/lambdas are not going to be inlined,
$$forInline version is not generated. However, all objects, which are
used in these suspend functions/lambdas, have $$forInline version
written to OUTERCLASS field. This leads to errors by proguard.
Since they are used in both state-machine version and for-inline ones,
we can simply remove $$forInline suffix from OUTERCLASS field and this
fixes the issue.

 #KT-31242 Fixed
This commit is contained in:
Ilmir Usmanov
2019-04-30 21:23:38 +03:00
parent dd6bc100ed
commit effbcdaf70
8 changed files with 126 additions and 32 deletions
@@ -3430,6 +3430,16 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt", "kotlin.coroutines");
}
@TestMetadata("enclodingMethod.kt")
public void testEnclodingMethod_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("enclodingMethod.kt")
public void testEnclodingMethod_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/enclodingMethod.kt", "kotlin.coroutines");
}
@TestMetadata("fileNameInMetadata.kt")
public void testFileNameInMetadata() throws Exception {
runTest("compiler/testData/codegen/boxInline/suspend/fileNameInMetadata.kt");