KT-723 optional boxing after call to .inc()

This commit is contained in:
Alex Tkachman
2012-02-17 09:08:41 -05:00
parent 614c5018f6
commit 082fdebaae
3 changed files with 16 additions and 2 deletions
@@ -2159,8 +2159,10 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
case -1:
throw new UnsupportedOperationException();
}
((CallableMethod)callable).invoke(v);
CallableMethod callableMethod = (CallableMethod) callable;
callableMethod.invoke(v);
StackValue.onStack(callableMethod.getSignature().getAsmMethod().getReturnType()).put(value.type, v);
value.store(v);
return StackValue.onStack(type);
}
@@ -0,0 +1,8 @@
fun Int?.inc() : Int { if (this != null) return this.inc() else throw NullPointerException() }
public fun box() : String {
var i : Int? = 10
val j = i++
return if(j==10 && 11 == i) "OK" else "fail"
}
@@ -285,4 +285,8 @@ public class ClassGenTest extends CodegenTestCase {
public void testKt1213() throws Exception {
// blackBoxFile("regressions/kt1213.kt");
}
public void testKt723() throws Exception {
blackBoxFile("regressions/kt723.kt");
}
}