KT-723 optional boxing after call to .inc()
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user