To accomplish this, we leverage Bluespec's functional struct updates. For instance, suppose we have a Copilot struct with fields x :: Field "x" Int32 and y :: Field "y" Int32. If we update a struct's x field to be 42, then the generated Bluespec code would look roughly like v { x = 42 }.
In order to test UpdateField (the copilot-core representation of struct field updates), we also generalize the test suite infrastructure a bit, as we need to be able to display and read struct values. Thankfully, this proves relatively straightforward.
To accomplish this, we leverage Bluespec's functional struct updates. For instance, suppose we have a Copilot struct with fields
x :: Field "x" Int32
andy :: Field "y" Int32
. If we update a struct'sx
field to be42
, then the generated Bluespec code would look roughly likev { x = 42 }
.In order to test
UpdateField
(thecopilot-core
representation of struct field updates), we also generalize the test suite infrastructure a bit, as we need to be able to display and read struct values. Thankfully, this proves relatively straightforward.Fixes #10.