Skip to content

Commit

Permalink
Support empty bitfield
Browse files Browse the repository at this point in the history
  • Loading branch information
trdthg committed Jan 22, 2025
1 parent f8de74b commit c3c90b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,8 @@ type_def:
{ mk_td (TD_variant ($2, TypQ_aux (TypQ_tq [], loc $endpos($2) $startpos($3)), $5)) $startpos $endpos }
| Union id typaram Eq Lcurly type_unions Rcurly
{ mk_td (TD_variant ($2, $3, $6)) $startpos $endpos }
| Bitfield id Colon typ Eq Lcurly Rcurly
{ mk_td (TD_bitfield ($2, $4, [])) $startpos $endpos }
| Bitfield id Colon typ Eq Lcurly r_def_body Rcurly
{ mk_td (TD_bitfield ($2, $4, $7)) $startpos $endpos }

Expand Down
11 changes: 11 additions & 0 deletions test/typecheck/pass/bitfield_empty.sail
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
default Order dec

$include <prelude.sail>

type xlen : Int = 2 ^ 2

bitfield foo : bits(xlen) = { }

bitfield bar : bits(xlen) = {

}

0 comments on commit c3c90b4

Please sign in to comment.