Skip to content

Commit

Permalink
Merge acdc607 into 2ca2e5c
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher authored Sep 4, 2024
2 parents 2ca2e5c + acdc607 commit a17c9dc
Show file tree
Hide file tree
Showing 7 changed files with 272 additions and 165 deletions.
20 changes: 18 additions & 2 deletions compiler/noirc_frontend/src/elaborator/comptime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,30 @@ impl<'context> Elaborator<'context> {
self.errors.push(error);
}
}
TopLevelStatement::Struct(struct_def) => {
if let Some((type_id, the_struct)) = dc_mod::collect_struct(
self.interner,
self.def_maps.get_mut(&self.crate_id).unwrap(),
struct_def,
self.file,
self.local_module,
self.crate_id,
&mut self.errors,
) {
generated_items.types.insert(type_id, the_struct);
}
}
TopLevelStatement::Impl(r#impl) => {
let module = self.module_id();
dc_mod::collect_impl(self.interner, generated_items, r#impl, self.file, module);
}

// Assume that an error has already been issued
TopLevelStatement::Error => (),

TopLevelStatement::Module(_)
| TopLevelStatement::Import(..)
| TopLevelStatement::Struct(_)
| TopLevelStatement::Trait(_)
| TopLevelStatement::Impl(_)
| TopLevelStatement::TypeAlias(_)
| TopLevelStatement::SubModule(_)
| TopLevelStatement::InnerAttribute(_) => {
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/comptime/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ impl<'a> From<&'a InterpreterError> for CustomDiagnostic {
InterpreterError::UnsupportedTopLevelItemUnquote { item, location } => {
let msg = "Unsupported statement type to unquote".into();
let secondary =
"Only functions, globals, and trait impls can be unquoted here".into();
"Only functions, structs, globals, and impls can be unquoted here".into();
let mut error = CustomDiagnostic::simple_error(msg, secondary, location.span);
error.add_note(format!("Unquoted item was:\n{item}"));
error
Expand Down
Loading

0 comments on commit a17c9dc

Please sign in to comment.