Fix for KT-5589: VerifyError when default value for parameter of local function is obtained from closure
#KT-5589 Fixed
This commit is contained in:
@@ -205,6 +205,10 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
|
||||
generateFunctionReferenceMethods(functionReferenceTarget);
|
||||
}
|
||||
|
||||
functionCodegen.generateDefaultIfNeeded(
|
||||
context.intoFunction(funDescriptor), funDescriptor, context.getContextKind(), DefaultParameterValueLoader.DEFAULT, null
|
||||
);
|
||||
|
||||
this.constructor = generateConstructor();
|
||||
|
||||
if (isConst(closure)) {
|
||||
@@ -212,10 +216,6 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
|
||||
}
|
||||
|
||||
genClosureFields(closure, v, typeMapper);
|
||||
|
||||
functionCodegen.generateDefaultIfNeeded(
|
||||
context.intoFunction(funDescriptor), funDescriptor, context.getContextKind(), DefaultParameterValueLoader.DEFAULT, null
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
fun box(): String {
|
||||
val x = "OK"
|
||||
fun bar(y: String = x): String = y
|
||||
return bar()
|
||||
}
|
||||
+6
@@ -1846,6 +1846,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt5589.kt")
|
||||
public void testKt5589() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/kt5589.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("localClassFunClosure.kt")
|
||||
public void testLocalClassFunClosure() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/localClassFunClosure.kt");
|
||||
|
||||
Reference in New Issue
Block a user