-
Notifications
You must be signed in to change notification settings - Fork 427
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
Generate empty interfaces for executables and tests #3768
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0ea7572
Initial implementation of implicit empty .mli files
craigfe 37f467d
Restrict empty .mli file generation to dune lang 2.8
craigfe a976489
Add basic documentation for empty interface generation
craigfe 7e29ca1
Add a negative test case for implicit intf generation
craigfe 88d5c07
Toggle interface generation with (executables_implicit_empty_intf)
craigfe 1ca0ef8
Restrict (executables_implicit_empty_intf) to Dune lang 2.9
craigfe 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 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 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
2 changes: 0 additions & 2 deletions
2
otherlibs/action-plugin/test/depends-on-its-target-by-read-dir/bin/foo.ml
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
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
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
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
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
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
1 change: 1 addition & 0 deletions
1
test/blackbox-tests/test-cases/executables-implicit-empty-intf.t/bin/dependency.ml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let a = 1 |
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/executables-implicit-empty-intf.t/bin/dune
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(executable | ||
(name executable)) |
1 change: 1 addition & 0 deletions
1
test/blackbox-tests/test-cases/executables-implicit-empty-intf.t/bin/executable.ml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let unused = Dependency.a |
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/executables-implicit-empty-intf.t/bin_with_intf/dune
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(executable | ||
(name executable)) |
1 change: 1 addition & 0 deletions
1
test/blackbox-tests/test-cases/executables-implicit-empty-intf.t/bin_with_intf/executable.ml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let a = 1 |
1 change: 1 addition & 0 deletions
1
.../blackbox-tests/test-cases/executables-implicit-empty-intf.t/bin_with_intf/executable.mli
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
val a : int |
47 changes: 47 additions & 0 deletions
47
test/blackbox-tests/test-cases/executables-implicit-empty-intf.t/run.t
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Executables with no corresponding `.mli` file will have one generated for them | ||
by Dune: | ||
|
||
$ cat >dune-project <<EOF | ||
> (lang dune 2.9) | ||
> (executables_implicit_empty_intf true) | ||
> EOF | ||
|
||
$ dune build ./bin/executable.exe | ||
File "bin/executable.ml", line 1, characters 4-10: | ||
1 | let unused = Dependency.a | ||
^^^^^^ | ||
Error (warning 32): unused value unused. | ||
[1] | ||
|
||
$ test ! -f _build/default/bin/dependency.mli | ||
$ cat _build/default/bin/executable.mli | ||
(* Auto-generated by Dune *) | ||
|
||
as will test binaries: | ||
|
||
$ dune runtest | ||
File "test/test.ml", line 1, characters 4-10: | ||
1 | let unused = 1 | ||
^^^^^^ | ||
Error (warning 32): unused value unused. | ||
[1] | ||
|
||
$ cat _build/default/test/test.mli | ||
(* Auto-generated by Dune *) | ||
|
||
If an executable already has an interface, it is preserved: | ||
|
||
$ dune clean | ||
$ dune build ./bin_with_intf/executable.exe | ||
$ cat _build/default/bin_with_intf/executable.mli | ||
val a : int | ||
|
||
Generation of empty `.mli` files is disabled by default prior to lang 3.0: | ||
|
||
$ dune clean | ||
$ echo >dune-project "(lang dune 2.9)" | ||
$ dune build ./bin/executable.exe | ||
$ dune runtest | ||
$ test ! -f _build/default/bin/executable.mli | ||
$ test ! -f _build/default/test/test.mli | ||
|
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/executables-implicit-empty-intf.t/test/dune
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(test | ||
(name test)) |
1 change: 1 addition & 0 deletions
1
test/blackbox-tests/test-cases/executables-implicit-empty-intf.t/test/test.ml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let unused = 1 |
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.
Fairly arbitrary interface choice here as it ended up being concise at the call-site; alternatives welcome.