//! > MacroExpand

//! > test_runner_name
test_macro_expand

//! > cairo_project.toml
[crate_roots]
hello = "src"

[config.global]
edition = "2024_07"

//! > cairo_code
struct A {
    a: felt252
}

#[genera<caret>te_trait]
impl ImplA of A<caret>Trait {
    fn c(self: A) -> felt252 {
        print<caret>ln!("a");<caret>
        self.a + 1
    }
}

//! > macro expand #0
// = source context
#[genera<caret>te_trait]
// = expansion
// generate_trait
// --------------

trait ATrait {
    fn c(self: A) -> felt252;
}

// lib.cairo
// ---------

#[generate_trait]
impl ImplA of ATrait {
    fn c(self: A) -> felt252 {
        {
            let mut __formatter_for_print_macros__: core::fmt::Formatter =
                core::traits::Default::default();
            core::result::ResultTrait::<
                (), core::fmt::Error
            >::unwrap(
                {
                    core::byte_array::ByteArrayTrait::append_word(
                        ref __formatter_for_print_macros__.buffer, 0x610a, 2
                    );
                    core::result::Result::<(), core::fmt::Error>::Ok(())
                }
            );
            core::debug::print_byte_array_as_string(@__formatter_for_print_macros__.buffer);
        };
        self.a + 1
    }
}

//! > macro expand #1
// = source context
impl ImplA of A<caret>Trait {
// = expansion
// generate_trait
// --------------

trait ATrait {
    fn c(self: A) -> felt252;
}

// lib.cairo
// ---------

#[generate_trait]
impl ImplA of ATrait {
    fn c(self: A) -> felt252 {
        {
            let mut __formatter_for_print_macros__: core::fmt::Formatter =
                core::traits::Default::default();
            core::result::ResultTrait::<
                (), core::fmt::Error
            >::unwrap(
                {
                    core::byte_array::ByteArrayTrait::append_word(
                        ref __formatter_for_print_macros__.buffer, 0x610a, 2
                    );
                    core::result::Result::<(), core::fmt::Error>::Ok(())
                }
            );
            core::debug::print_byte_array_as_string(@__formatter_for_print_macros__.buffer);
        };
        self.a + 1
    }
}

//! > macro expand #2
// = source context
        print<caret>ln!("a");
// = expansion
// lib.cairo
// ---------

{
    let mut __formatter_for_print_macros__: core::fmt::Formatter = core::traits::Default::default();
    core::result::ResultTrait::<
        (), core::fmt::Error
    >::unwrap(
        {
            core::byte_array::ByteArrayTrait::append_word(
                ref __formatter_for_print_macros__.buffer, 0x610a, 2
            );
            core::result::Result::<(), core::fmt::Error>::Ok(())
        }
    );
    core::debug::print_byte_array_as_string(@__formatter_for_print_macros__.buffer);
}

//! > macro expand #3
// = source context
        println!("a");<caret>
// = expansion
// generate_trait
// --------------

trait ATrait {
    fn c(self: A) -> felt252;
}

// lib.cairo
// ---------

#[generate_trait]
impl ImplA of ATrait {
    fn c(self: A) -> felt252 {
        {
            let mut __formatter_for_print_macros__: core::fmt::Formatter =
                core::traits::Default::default();
            core::result::ResultTrait::<
                (), core::fmt::Error
            >::unwrap(
                {
                    core::byte_array::ByteArrayTrait::append_word(
                        ref __formatter_for_print_macros__.buffer, 0x610a, 2
                    );
                    core::result::Result::<(), core::fmt::Error>::Ok(())
                }
            );
            core::debug::print_byte_array_as_string(@__formatter_for_print_macros__.buffer);
        };
        self.a + 1
    }
}
