Fix for KT-13182: Regression: compiler internal error at inline
#KT-13182 Fixed
This commit is contained in:
@@ -262,7 +262,8 @@ public class MethodInliner {
|
|||||||
owner + "." + name + ", info " + transformationInfo;
|
owner + "." + name + ", info " + transformationInfo;
|
||||||
InliningContext parent = inliningContext.getParent();
|
InliningContext parent = inliningContext.getParent();
|
||||||
boolean shouldRegenerate = transformationInfo.shouldRegenerate(isSameModule);
|
boolean shouldRegenerate = transformationInfo.shouldRegenerate(isSameModule);
|
||||||
if (shouldRegenerate || (parent != null && parent.isContinuation())) {
|
boolean isContinuation = parent != null && parent.isContinuation();
|
||||||
|
if (shouldRegenerate || isContinuation) {
|
||||||
assert shouldRegenerate || inlineCallSiteInfo.getOwnerClassName().equals(transformationInfo.getOldClassName())
|
assert shouldRegenerate || inlineCallSiteInfo.getOwnerClassName().equals(transformationInfo.getOldClassName())
|
||||||
: "Only coroutines can call their own constructors";
|
: "Only coroutines can call their own constructors";
|
||||||
|
|
||||||
@@ -270,7 +271,7 @@ public class MethodInliner {
|
|||||||
AnonymousObjectTransformationInfo info = (AnonymousObjectTransformationInfo) transformationInfo;
|
AnonymousObjectTransformationInfo info = (AnonymousObjectTransformationInfo) transformationInfo;
|
||||||
|
|
||||||
AnonymousObjectTransformationInfo oldInfo = inliningContext.findAnonymousObjectTransformationInfo(owner);
|
AnonymousObjectTransformationInfo oldInfo = inliningContext.findAnonymousObjectTransformationInfo(owner);
|
||||||
if (oldInfo != null) {
|
if (oldInfo != null && isContinuation) {
|
||||||
info = oldInfo;
|
info = oldInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// FILE: 1.kt
|
||||||
|
|
||||||
|
package test
|
||||||
|
|
||||||
|
inline fun test(cond: Boolean, crossinline cif: () -> String): String {
|
||||||
|
return if (cond) {
|
||||||
|
{ cif() }()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cif()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// FILE: 2.kt
|
||||||
|
|
||||||
|
import test.*
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val s = "OK"
|
||||||
|
return test(true) {
|
||||||
|
{
|
||||||
|
s
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -127,6 +127,12 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt13182.kt")
|
||||||
|
public void testKt13182() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt13182.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt6552.kt")
|
@TestMetadata("kt6552.kt")
|
||||||
public void testKt6552() throws Exception {
|
public void testKt6552() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt");
|
||||||
|
|||||||
+6
@@ -127,6 +127,12 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt13182.kt")
|
||||||
|
public void testKt13182() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt13182.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt6552.kt")
|
@TestMetadata("kt6552.kt")
|
||||||
public void testKt6552() throws Exception {
|
public void testKt6552() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user