Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was 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

Description

@bamarsha

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: diagnosticsThe Q# compiler's error reporting mechanismenhancementNew request or suggestion for an improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions