explicitly size literals in converted default struct patterns

This commit is contained in:
Zachary Snow 2019-04-15 23:28:03 -04:00
parent da9452bd26
commit 75e2fba597
1 changed files with 2 additions and 2 deletions

View File

@ -213,8 +213,8 @@ convertAsgn structs types (lhs, expr) =
where e' = convertExpr (IntegerVector t sg rs) e
convertExpr (Struct (Packed sg) fields (_:rs)) (Bit e _) =
convertExpr (Struct (Packed sg) fields rs) e
convertExpr (Struct (Packed _) fields _) (Pattern [(Just "default", e)]) =
Concat $ take (length fields) (repeat e)
convertExpr (t @ (Struct (Packed _) fields _)) (Pattern [(Just "default", e)]) =
convertExpr t $ Pattern $ take (length fields) (repeat (Nothing, e))
convertExpr (Struct (Packed sg) fields []) (Pattern itemsOrig) =
if length items /= length fields then
error $ "struct pattern " ++ show items ++