c3c
c3c copied to clipboard
Optional does not propagate for bitstruct operators
bitstruct Foo : int {
bool a;
}
fn void main() {
Foo? a, b;
Foo? c = a | b;
// ^^^^^
// Error: | is not defined in the expression 'Foo?' | 'Foo?'.
Foo? d = a & b;
// ^^^^^
// Error: & is not defined in the expression 'Foo?' & 'Foo?'.
Foo? e = a ^ b;
// ^^^^^
// Error: ^ is not defined in the expression 'Foo?' ^ 'Foo?'.
}
This should work properly now. There was further problems when hiding bools and bitstructs behind typedefs as well. It works for the test cases I've added, but maybe there is more. Note that all three bitops are handled in the same code path, so if one works, all the others work as well.