Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Support secondary notes and possible-cause hints for diagnostics #1407

Open
bamarsha opened this issue Apr 8, 2022 · 0 comments
Open

Support secondary notes and possible-cause hints for diagnostics #1407

bamarsha opened this issue Apr 8, 2022 · 0 comments
Labels
area: diagnostics The Q# compiler's error reporting mechanism enhancement New request or suggestion for an improvement

Comments

@bamarsha
Copy link
Contributor

bamarsha commented Apr 8, 2022

In some cases, the cause of an error message may not be localized to the point where the error is generated. It could have multiple causes or related aspects in different parts of the program. It would be helpful if the compiler could direct the user to these parts so they could get more context or consider changing them.

For example:

let f = x -> x * x;
let _ = f([2]);

Here an error message for the expression [2] is generated, saying that it doesn't support arithmetic operators. This is correct, but the cause of this requirement is the use of the * operator in the lambda.

Unfortunately, the compiler isn't capable of generating a diagnostic inside the previous statement, because the diagnostic range must be relative to the current statement. This limitation would need to be removed to support this.

@bamarsha bamarsha added enhancement New request or suggestion for an improvement area: diagnostics The Q# compiler's error reporting mechanism labels Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: diagnostics The Q# compiler's error reporting mechanism enhancement New request or suggestion for an improvement
Projects
None yet
Development

No branches or pull requests

1 participant