JVM: fix remapping of new T inside regenerated copies of T

In general, `InliningContext.findAnonymousTransformationInfo` was not
reliable because it mapped each type to *some* info for that type,
preferring ones with `shouldRegenerate == true` if those exist. Thus, it
returned incorrect results if one type was regenerated multiple times,
e.g. in a nested inlining context or because of a `finally` (which
duplicates anonymous objects). The solution is to avoid a global map and
attach the current transformation info directly to the current inlining
context.
This commit is contained in:
pyos
2020-04-14 18:03:53 +02:00
committed by max-kammerer
parent 3f8ffb5ea7
commit 456469eb3b
10 changed files with 153 additions and 63 deletions
@@ -3953,6 +3953,16 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt", "kotlin.coroutines");
}
@TestMetadata("twiceRegeneratedAnonymousObject.kt")
public void testTwiceRegeneratedAnonymousObject() throws Exception {
runTest("compiler/testData/codegen/boxInline/suspend/twiceRegeneratedAnonymousObject.kt");
}
@TestMetadata("twiceRegeneratedSuspendLambda.kt")
public void testTwiceRegeneratedSuspendLambda() throws Exception {
runTest("compiler/testData/codegen/boxInline/suspend/twiceRegeneratedSuspendLambda.kt");
}
@TestMetadata("compiler/testData/codegen/boxInline/suspend/callableReference")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)