KT-707 default params for constructors

This commit is contained in:
Alex Tkachman
2011-12-08 19:22:09 +02:00
parent c80e42eff3
commit 602aea0467
3 changed files with 19 additions and 2 deletions
@@ -366,8 +366,12 @@ public class FunctionCodegen {
if(kind == OwnerKind.TRAIT_IMPL) {
iv.invokeinterface(ownerInternalName, jvmSignature.getName(), jvmSignature.getDescriptor());
}
else
iv.invokevirtual(ownerInternalName, jvmSignature.getName(), jvmSignature.getDescriptor());
else {
if(!isConstructor)
iv.invokevirtual(ownerInternalName, jvmSignature.getName(), jvmSignature.getDescriptor());
else
iv.invokespecial(ownerInternalName, jvmSignature.getName(), jvmSignature.getDescriptor());
}
}
else {
iv.invokestatic(ownerInternalName, jvmSignature.getName(), jvmSignature.getDescriptor());
@@ -0,0 +1,9 @@
class List<T>(val head: T, val tail: List<T>? = null)
fun <T> List<T>.mapHead(f: fun(T): T): List<T> = List<T>(f(head), null)
fun box() : String {
val a: Int = List<Int>(1).mapHead{it * 2}.head
System.out?.println(a)
return "OK"
}
@@ -225,4 +225,8 @@ public class ClassGenTest extends CodegenTestCase {
public void testKt285 () throws Exception {
// blackBoxFile("regressions/kt285.jet");
}
public void testKt707 () throws Exception {
blackBoxFile("regressions/kt707.jet");
}
}