FuelLabs / sway

🌴 Empowering everyone to build reliable and efficient smart contracts.
https://docs.fuel.network/docs/sway/
Apache License 2.0
62.76k stars 5.36k forks source link

Aliases can make compilation fail with "missing `core` dependencies`" & Could not generate entry method #6569

Open DefiCake opened 1 week ago

DefiCake commented 1 week ago

Related Component

compiler

Problem

Using an enum alias as a return type confuses the compiler and makes it fail on build.

contract;

use standards::src5::{SRC5, State as SRC5State};

configurable {
    INITIAL_OWNER: SRC5State = SRC5State::Initialized(Identity::Address(Address::zero()))
}

impl SRC5 for Contract {
    #[storage(read)]
    fn owner() -> SRC5State {
        INITIAL_OWNER
    }
}

Here, just renaming SRC5State back to State will make the build pass.

Steps

See reproduction: https://github.com/DefiCake/forc-alias-compilation-error

Possible Solution(s)

No response

Notes

No response

Installed components

forc --version
forc 0.63.5