Skip to content

Commit

Permalink
Fix interpreter panic
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher committed Jul 17, 2024
1 parent 30cb65a commit 510d16c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions compiler/noirc_frontend/src/elaborator/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,13 +753,16 @@ impl<'context> Elaborator<'context> {
) -> Result<FuncId, ResolverError> {
match self.interner.expression(&func) {
HirExpression::Ident(ident, _generics) => {
let definition = self.interner.definition(ident.id);
if let DefinitionKind::Function(function) = definition.kind {
let meta = self.interner.function_modifiers(&function);
if meta.is_comptime {
Ok(function)
if let Some(definition) = self.interner.try_definition(ident.id) {
if let DefinitionKind::Function(function) = definition.kind {
let meta = self.interner.function_modifiers(&function);
if meta.is_comptime {
Ok(function)
} else {
Err(ResolverError::MacroIsNotComptime { span: location.span })
}
} else {
Err(ResolverError::MacroIsNotComptime { span: location.span })
Err(ResolverError::InvalidSyntaxInMacroCall { span: location.span })
}
} else {
Err(ResolverError::InvalidSyntaxInMacroCall { span: location.span })
Expand Down

0 comments on commit 510d16c

Please sign in to comment.