fabianschuiki / moore

A hardware compiler based on LLHD and CIRCT
http://www.llhd.io
Apache License 2.0
246 stars 31 forks source link

Pattern default expr casts to wrong type for structs with distinct field types #186

Closed fabianschuiki closed 4 years ago

fabianschuiki commented 4 years ago

When a pattern is used to assign a struct which has fields of different types, the expression passed to the default value is cast to one of the types (presumably the first one), but then used for all of the fields. This triggers an assertion in MIR lowering, since the types don't line up. This would require the expression assigned to default to be replicated for each unassigned struct field, such that there are distinct AST/HIR nodes that can be typed separately.