Preserve declarations with unsatisfied @Config attributes
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1k
- Forks
- 212
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 65
Description
A simulation-only function like `Std.Random.DrawRandomInt` is annotated with a `@Config` attribute (in this case, `@Config(Unrestricted)`) to indicate that it shouldn't be available unless a suitable profile has been selected. Such functions are filtered out quite early in the compilation process (AST probably?) with the result that the design time error is "unresolved name". It would be much more user friendly to resolve the name and then explain why it's not available. Besides improving the error experience, this would make features like Quick Info and Go-to-Def available.
There's a substantial wrinkle: we don't use config only to remove unavailable functionality. Sometimes, multiple implementations are provided - for example, a simple one for Base profile and a more efficient one for Adaptive. If multiple implementations have unsatisfied config attributes, it's much less clear which to resolve in the editor.
One direction to consider might be to introduce an internal concept of stub/skeleton/declaration-only signatures without bodies. This would retain the benefit of not having to compile the implementation, while also keeping it available at design time.
In the interim, we might be able to hack the multiple implementations case by having an unconditionally available function that calls one of multiple conditionally available (i.e. depending on the profile) inner functions.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing where functions with unsatisfied @Config attributes are filtered during AST or early compilation, then examine how design-time name resolution handles multiple conditional implementations. Done means declarations remain available for diagnostics, Quick Info, and Go-to-Def while unavailable implementations are still excluded from compilation and ambiguous implementations have a defined resolution strategy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, quantum-computing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100