String representation of anonymous bitfield in units
Opened this issue · 1 comments
awelzel commented
module Test;
import spicy;
public type Header = unit {
: bitfield(16) {
fin: 0;
rsv: 1..3;
opcode: 4..7;
remaining: 8..15;
} &bit-order=spicy::BitOrder::MSB0;
on %done {
print "fin", self.fin, "opcode", self.opcode;
print self;
}
};
$ printf "\x82\xff" | spicy-driver ./test.spicy
fin, 1, opcode, 2
[$<anon>=(1, 0, 2, 255)]
As discussed in Slack, it's a bit surprising that the "lifted" fields are not shown in the string representation of the unit and instead the $<anon>
part shows up.
rsmmr commented
I would have sworn that we were lifting this up now after the recent changes, but indeed I do see this in our baselines, too:
spicy.types.bitfield.anonymous-field
:
[$<anon>=(15, 15), $<anon>=(not set)]
spicy-dump
does lift it up. From the same test:
Test::Foo {
x: 15
y: 15
}