Skip to content

Running nargo fmt repeatedly results in cycle of self-reverting changes #7407

@benesjan

Description

@benesjan

Aim

I run nargo fmt repeatedly but this change is getting introduced and then reverted in a loop:

Image

This is now causing my PR to not be mergeable because it keeps on failing in CI due to the formatter check.

To Reproduce

Format this piece of code repeatedly and you should observe repeated changes:

comptime fn generate_compute_note_hash_and_optionally_a_nullifier() -> Quoted {
    let notes = NOTES.entries();
    if notes.len() > 0 {
        for i in 0..notes.len() {
            let (typ, (_, _, _, _)) = notes[i];

            let get_note_type_id = typ.get_trait_impl(NOTE_INTERFACE).unwrap().methods().filter(|m| {
                m.name() == quote { get_note_type_id }
            })[0]
                .as_typed_expr();
        }

        quote {}
    } else {
        quote {}
    }
}

Nargo Version

nargo version = 1.0.0-beta.2 noirc version = 1.0.0-beta.2+0000000000000000000000000000000000000000 (git version hash: 0000000000000000000000000000000000000000, is dirty: false)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions