FuelLabs / sway

🌴 Empowering everyone to build reliable and efficient smart contracts.

Home Page:https://fuellabs.github.io/sway

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve error message when using a configurable in the initialization of another configurable

ironcev opened this issue · comments

Currently, we just get the generic error saying the initializer cannot be evaluated to const:

configurable {
    FIRST: u64 = 0,
    SECOND: u64 = FIRST + 1,
    ^^^^^^ Could not evaluate initializer to a const declaration.
}

Since defining constants via other constants is a regular practice, I expect having the same approach to configurables can happen although it is a clear logical error.

In general, we want to improve the generic error by pointing to the reason why it cannot be evaluated. This should be the part of the overall improvement in const eval, const fn etc.