Struct initialization errors unexpectactly

Hi guys, easy reproducer follows. Running everything on latest.
Uncomment the second struct initialization to get the error. First one works, as soon as second is added, it errors.

contract;

abi MyContract {
    fn test_function() -> bool;
}

struct Foo {
    a: u64,
    b: u64,
    c: u64,
    d: u64,
    e: u64,
    f: u64,
}

impl Foo {
    fn new(
        a: u64,
        b: u64,
        c: u64,
        d: u64,
        e: u64,
        f: u64,
    ) -> Self {
        Self {
            a,
            b,
            c,
            d,
            e,
            f,
        }
    }
}

impl MyContract for Contract {
    fn test_function() -> bool {
        let bar1 = Foo::new(0,0,0,0,0,0);
        // let bar2 = Foo::new(0,0,0,0,0,0);
        true
    }
}

The error you will see:

thread 'main' panicked at 'not yet implemented: can't do more than 6 args yet', sway-core/src/asm_generation/fuel/functions.rs:74:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

As always, thanks for any help.

We will take a look at this asap! Certainly a bug. Filed here: Compiler panics with "can't do more than 6 args yet" · Issue #4477 · FuelLabs/sway · GitHub

Thanks a lot Mohammad :slight_smile: