KT-665 wrong 0 on default long argument

This commit is contained in:
Alex Tkachman
2011-12-01 18:14:02 +02:00
parent 6febd82b99
commit 6825fc8879
2 changed files with 20 additions and 0 deletions
@@ -1307,6 +1307,9 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
else if(type.getSort() == Type.DOUBLE) {
v.aconst(0d);
}
else if(type.getSort() == Type.LONG) {
v.aconst(0l);
}
else {
v.iconst(0);
}
@@ -284,4 +284,21 @@ public class PrimitiveTypesTest extends CodegenTestCase {
public void testKt518 () throws Exception {
blackBoxFile("regressions/kt518.jet");
}
public void testKt665() throws Exception {
loadText("fun f(x: Long, zzz: Long = 1): Long\n" +
"{\n" +
" return if (x <= 1) zzz\n" +
" else f(x-1, x*zzz)\n" +
"}\n" +
"\n" +
"fun box() : String\n" +
"{\n" +
" val six: Long = 6;\n" +
" System.out?.println(f(six))\n" +
" return \"OK\"" +
"}");
System.out.println(generateToText());
blackBox();
}
}