-
Notifications
You must be signed in to change notification settings - Fork 454
Stop changing the default warning set of the compiler #12766
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
Open
nojb
wants to merge
15
commits into
ocaml:main
Choose a base branch
from
nojb:dune_warnings
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
39a6c57
Stop changing the default OCaml warnings
nojb 7fbe8fb
Add test
nojb 68caf05
%{dune-warnings} should not depend on the profile
nojb 1556ac6
Changes
nojb f5ea470
Doc
nojb 9ac4ca7
Fix
nojb 2d097d6
Merge branch 'main' into dune_warnings
nojb 746953e
Wording
nojb 6563f88
Merge branch 'main' into dune_warnings
nojb 5c4861b
Use %{dune-warnings} in Dune itself
nojb c9a450e
Merge branch 'main' into dune_warnings
nojb 051c53f
Changes
nojb e527ba4
Merge branch 'main' into dune_warnings
nojb 93a7808
Merge branch 'main' into dune_warnings
nojb 5a5496e
Merge branch 'main' into dune_warnings
nojb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - Starting with version 3.21 of the Dune language, Dune no longer changes the | ||
| default set of compiler warnings. For users that would like to keep the old | ||
| behaviour, the variable `%{dune-warnings}` can be used in an `(env)` stanza in | ||
| a top-level Dune file: `(env (dev (flags :standard %{dune-warnings})))`. | ||
| (#12766, @nojb) | ||
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| Black-box testing: we check that warning 32 (unused-value-declaration) is | ||
| enabled by default in the dev profile in Dune version 3.20 but not in 3.21. | ||
|
|
||
| $ cat >dune-project <<EOF | ||
| > (lang dune 3.20) | ||
| > EOF | ||
|
|
||
| $ cat >main.ml <<EOF | ||
| > let unused = 42 | ||
| > EOF | ||
|
|
||
| $ cat >main.mli <<EOF | ||
| > EOF | ||
|
|
||
| $ cat >dune <<EOF | ||
| > (executable (name main)) | ||
| > EOF | ||
|
|
||
| $ dune build | ||
| File "main.ml", line 1, characters 4-10: | ||
| 1 | let unused = 42 | ||
| ^^^^^^ | ||
| Error (warning 32 [unused-value-declaration]): unused value unused. | ||
| [1] | ||
|
|
||
| Now in 3.21... | ||
|
|
||
| $ cat >dune-project <<EOF | ||
| > (lang dune 3.21) | ||
| > EOF | ||
|
|
||
| $ dune build | ||
|
|
||
| Version check for %{dune-warnings}. | ||
|
|
||
| $ cat >dune-project <<EOF | ||
| > (lang dune 3.20) | ||
| > EOF | ||
|
|
||
| $ cat >dune <<EOF | ||
| > (executable (name main) (flags :standard %{dune-warnings})) | ||
| > EOF | ||
|
|
||
| $ dune build | ||
| File "dune", line 1, characters 41-57: | ||
| 1 | (executable (name main) (flags :standard %{dune-warnings})) | ||
| ^^^^^^^^^^^^^^^^ | ||
| Error: %{dune-warnings} is only available since version 3.21 of the dune | ||
| language. Please update your dune-project file to have (lang dune 3.21). | ||
| [1] | ||
|
|
||
| $ cat >dune-project <<EOF | ||
| > (lang dune 3.21) | ||
| > EOF | ||
|
|
||
| $ dune build | ||
| File "main.ml", line 1, characters 4-10: | ||
| 1 | let unused = 42 | ||
| ^^^^^^ | ||
| Error (warning 32 [unused-value-declaration]): unused value unused. | ||
| [1] | ||
|
|
||
| What _is_ %{dune-warnings} ? | ||
|
|
||
| $ cat >dune <<EOF | ||
| > (rule (alias show) (action (echo "%{dune-warnings}\n"))) | ||
| > EOF | ||
|
|
||
| $ dune build @show | ||
| -w @1..3@5..28@31..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats | ||
|
|
||
| Warnings are still fatal in dev mode. | ||
|
|
||
| $ cat >main.ml <<EOF | ||
| > let f = function 0 -> 1 | ||
| > EOF | ||
|
|
||
| $ cat >dune <<EOF | ||
| > (executable (name main)) | ||
| > EOF | ||
|
|
||
| $ dune build | ||
| File "main.ml", line 1, characters 8-23: | ||
| 1 | let f = function 0 -> 1 | ||
| ^^^^^^^^^^^^^^^ | ||
| Error (warning 8 [partial-match]): this pattern-matching is not exhaustive. | ||
| Here is an example of a case that is not matched: | ||
| 1 | ||
| [1] |
Oops, something went wrong.
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.
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.
Since dune itself is already using 3.21, you should use
%{dune-warnings}in our root dune file.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.
Good catch. Fixed in 5c4861b