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:
Michael Bogdanov
2015-11-03 12:30:24 +03:00
parent 141ffa27dc
commit 9daa44566b
3 changed files with 15 additions and 4 deletions
@@ -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
+5
View File
@@ -0,0 +1,5 @@
fun box(): String {
val x = "OK"
fun bar(y: String = x): String = y
return bar()
}
@@ -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");