Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ironcev opened this issue May 9, 2024 · 0 comments
Labels
compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler General compiler. Should eventually become more specific as the issue is triaged

Comments

@ironcev
Copy link
Member

ironcev commented May 9, 2024

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.

@ironcev ironcev added compiler General compiler. Should eventually become more specific as the issue is triaged compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler General compiler. Should eventually become more specific as the issue is triaged
Projects
None yet
Development

No branches or pull requests

1 participant