Improve dune lang version not supported error message#11934
Closed
Alizter wants to merge 2 commits intoocaml:mainfrom
Closed
Improve dune lang version not supported error message#11934Alizter wants to merge 2 commits intoocaml:mainfrom
Alizter wants to merge 2 commits intoocaml:mainfrom
Conversation
3174b02 to
26aab68
Compare
Previously, we would output the version we were parsing which led to
nonsensical error messages like:
```
File "dune-project", line 1, characters 11-18:
1 | (lang dune 123.123)
^^^^^^^
Error: Version 123.123 of the dune language is not supported.
Supported versions of this extension in version 123.123 of the dune language:
- 1.0 to 1.12
- 2.0 to 2.9
- 3.0 to 3.20
```
We fix this by passing the current supported version of dune lang
instead of the one we just parsed, allowing the error message to
beceome:
```
File "dune-project", line 1, characters 11-18:
1 | (lang dune 123.123)
^^^^^^^
Error: Version 123.123 of the dune language is not supported.
Supported versions of this extension in version 3.20 of the dune language:
- 1.0 to 1.12
- 2.0 to 2.9
- 3.0 to 3.20
```
The error message is still a bit nonsensical due to us mentioning
extensions here, but that will be left as a future improvement.
Signed-off-by: Ali Caglayan <alizter@gmail.com>
7644cba to
15267e9
Compare
When we display an error for an outdated dune version which can happen when `dune lang` appears to be unsupported by the current version of dune, we used to mention an "extension". This was confusing to users who didn't know about language extensions or that dune lang was an extension under the hood. We improve the error message by using some of the information already provided by dune_lang/syntax.ml. Signed-off-by: Ali Caglayan <alizter@gmail.com>
15267e9 to
8dbf2b2
Compare
Collaborator
Author
|
Better alternative in #12833 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR we do two things:
But we are not in version
123.123!We fix this by passing the current supported version of dune lang instead of the one we just parsed, allowing the error message to become:
dune_lang/syntax.mlwhich we make use of. This allows an error message like before to become:Before we were mentioning "extensions" to the user which doesn't make too much sense in this context.