Support move on depth 2
This commit is contained in:
@@ -413,10 +413,16 @@ public abstract class StackValue {
|
||||
put(type, v);
|
||||
}
|
||||
else if (depth == 1) {
|
||||
if (this.type.getSize() != 1) {
|
||||
int size = this.type.getSize();
|
||||
if (size == 1) {
|
||||
v.swap();
|
||||
} else if (size == 2) {
|
||||
v.dupX2();
|
||||
v.pop();
|
||||
} else {
|
||||
throw new UnsupportedOperationException("don't know how to move type " + type + " to top of stack");
|
||||
}
|
||||
v.swap();
|
||||
|
||||
coerceTo(type, v);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
fun f(b : Long.(Long)->Long) = 1L?.b(2L)
|
||||
|
||||
fun box(): String {
|
||||
val x = f { this + it }
|
||||
return if (x == 3L) "OK" else "fail $x"
|
||||
}
|
||||
@@ -5808,6 +5808,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("safeCallOnLong.kt")
|
||||
public void testSafeCallOnLong() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/safeCall/safeCallOnLong.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("staticCall.kt")
|
||||
public void testStaticCall() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/safeCall/staticCall.kt");
|
||||
|
||||
Reference in New Issue
Block a user