diff --git a/src/lib/parser.mly b/src/lib/parser.mly index 84b8439ba..98da75bc1 100644 --- a/src/lib/parser.mly +++ b/src/lib/parser.mly @@ -859,7 +859,7 @@ vector_update: { VU_single (mk_exp (E_id $1) $startpos $endpos, mk_exp (E_id $1) $startpos $endpos)} vector_update_list: - | vector_update + | vector_update Comma? { [$1] } | vector_update Comma vector_update_list { $1 :: $3 } diff --git a/test/typecheck/bitfield_trailing_comma.sail b/test/typecheck/bitfield_trailing_comma.sail new file mode 100644 index 000000000..5b18baa7d --- /dev/null +++ b/test/typecheck/bitfield_trailing_comma.sail @@ -0,0 +1,15 @@ +default Order dec + +$include + +bitfield foo : bits(8) = { + f1 : 3 .. 0, + f2 : 7 .. 4, +} + +val main : unit -> unit + +function main() = { + let x = [Mk_foo(0x00) with f1 = 0xA, f2 = 0xB, ]; + () +} \ No newline at end of file