Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions crates/cairo-lang-semantic/src/expr/test_data/inline_macros
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,7 @@ error: Expected path after modifier.
//! > Test macro context resolution through use-star.

//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
test_function_diagnostics(expect_diagnostics: false)

//! > crate_settings
edition = "2024_07"
Expand Down Expand Up @@ -1942,10 +1942,6 @@ mod a {
use a::*;

//! > expected_diagnostics
error[E0006]: Function not found.
--> lib.cairo:12:5
bar();
^^^

//! > ==========================================================================

Expand Down
12 changes: 8 additions & 4 deletions crates/cairo-lang-semantic/src/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ impl<'db> Resolver<'db> {
Some(info) => Ok(info),
None => {
if let Some((info, _macro_mod)) =
self.resolve_item_in_macro_calls(*module_id, identifier)
self.resolve_item_in_macro_calls(*module_id, identifier.text(db))
{
return Ok(info);
}
Expand Down Expand Up @@ -1594,6 +1594,11 @@ impl<'db> Resolver<'db> {
self.insert_used_use(inner_item_info.item_id);
return Some(inner_item_info);
}
if let Some((inner_item_info, _macro_mod)) =
self.resolve_item_in_macro_calls(module_id, ident)
{
return Some(inner_item_info);
}
None
}

Expand Down Expand Up @@ -1732,7 +1737,7 @@ impl<'db> Resolver<'db> {
return Ok(ResolvedBase::Module(self.prelude_submodule_ex(macro_context_modifier)));
}
if let Some((item_info, module_id)) =
self.resolve_item_in_macro_calls(module_id, identifier)
self.resolve_item_in_macro_calls(module_id, identifier.text(db))
{
return Ok(ResolvedBase::FoundThroughGlobalUse {
item_info,
Expand Down Expand Up @@ -1769,10 +1774,9 @@ impl<'db> Resolver<'db> {
fn resolve_item_in_macro_calls(
&mut self,
module_id: ModuleId<'db>,
identifier: &ast::TerminalIdentifier<'db>,
ident: &'db str,
) -> Option<(ModuleItemInfo<'db>, ModuleId<'db>)> {
let db = self.db;
let ident = identifier.text(db);
let mut queue: VecDeque<_> =
self.db.module_macro_calls_ids(module_id).ok()?.iter().copied().collect();
while let Some(macro_call_id) = queue.pop_front() {
Expand Down