-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
At the moment, constructors for union types generate custom classes. For example, this:
type union is int | int[]
Generates this class:
static class union {
final private int tag;
final private Object content;
public union(BigInteger content) {
this.tag = 0;
this.content = content;
}
public union(BigInteger[] content) {
this.tag = 1;
this.content = content;
}
public boolean isBigInteger() {
return this.tag == 0;
}
...
}
This is fine, but note that the constructors overload based on the underlying type of each case. This causes problems if these types are the same. Note, even if the Whiley type differs, the underlying type can still be the same (for example, think about int:8 versus int:16).
Metadata
Metadata
Assignees
Labels
No labels