Skip to content

Commit

Permalink
Return empty fields by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher committed Jan 21, 2025
1 parent 13b865c commit b516302
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/noirc_frontend/src/hir_def/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ impl DataType {
fn fields_raw(&self) -> &[StructField] {
match &self.body {
TypeBody::Struct(fields) => fields,
// Turns out we call `fields_raw` in a few places before a type may be fully finished.
// One of these is when checking for nested slices, so that check will have false
// negatives.
TypeBody::None => &[],
_ => panic!("Called DataType::fields_raw on a non-struct type: {}", self.name),
}
}
Expand Down

0 comments on commit b516302

Please sign in to comment.