-
Notifications
You must be signed in to change notification settings - Fork 412
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
Enhanced error messages for invalid library/executables names #3646
Merged
Conversation
This file contains 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
rgrinberg
reviewed
Jul 27, 2020
rgrinberg
reviewed
Jul 28, 2020
src/dune/dune_file.ml
Outdated
Option.iter names | ||
~f: | ||
(List.iter ~f:(fun name -> | ||
ignore (Module_name.parse_string_exn name))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we specify the type of the value we're ignoring? That's a convention we follow in dune because it's error prone to keep ignoring values if the type returned changes.
rgrinberg
approved these changes
Jul 28, 2020
voodoos
force-pushed
the
invalid-public-name
branch
from
August 5, 2020 12:37
80866fe
to
d9aa0ad
Compare
Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com> Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com> Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com> Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
voodoos
force-pushed
the
invalid-public-name
branch
from
August 5, 2020 12:39
d9aa0ad
to
76834db
Compare
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.
Actual behavior
When an executable has an invalid name, dune wrongly states that this module doesn't exist, while it not a valid module name:
Moreover libraries have a better message when only the
public_name
is specified and it is not a valid module name:This is not the case for executables.
In this PR
New behavior (see tests for more)
Note
These messages and validation do not take into account the fact that the
ocamlc
compiler does accept, with a warning, an invalid name for the main module: