The following fails:
public export method test() :
{bool flag, int code} x = {flag: true, code: 0}
if x.flag:
assert true
else:
assert false
This generates the following Java:
import java.math.BigInteger;
import java.util.Arrays;
import java.util.function.Function;
public final class BoolRecord_Valid_2 {
public static void test() {
Struct0 x = new Struct0(true, BigInteger.valueOf(0L));
if(x.clone().flag) {
assert true;
} else {
assert false;
}
}
static class Struct0 {
boolean flag;
BigInteger code;
...
public Object clone() {
return new Struct0(flag, code);
}
}
}
The problem is that clone() returns object, rather than Struct0. Alternatively, the problem is that we shouldn't be cloning at this point anyway.
The following fails:
This generates the following Java:
The problem is that
clone()returns object, rather thanStruct0. Alternatively, the problem is that we shouldn't be cloning at this point anyway.