-
Notifications
You must be signed in to change notification settings - Fork 89
Add -as-argument-for
parameter
#2177
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
Merged
Merged
Changes from all commits
Commits
Show all changes
114 commits
Select commit
Hold shift + click to select a range
80a2978
Add `-as-parameter` option
lukemaurer 65d7cbd
Use `CU.Name.t` for name of .cmi; support import info for parameters
lukemaurer cf8f9e1
Missed a few changes
lukemaurer 25b63ca
Refactor `Persistent_env` to separate imports from bound names
lukemaurer d0a1675
Merge branch 'cu-name-is-cmi' into layered-persistent_env
lukemaurer 5cde426
Add `-as-argument-for`
lukemaurer ef2c16b
Add checks for misuse of `-as-parameter`
lukemaurer 546e73a
Raise error on combination of `-as-parameter` and `-for-pack`
lukemaurer 7f03329
Add test for check for compiling `.ml` of parameter `.mli`
lukemaurer 431d6bb
Add test of check for `-as-parameter` on implementation
lukemaurer 37e88f3
Remove stray debug code
lukemaurer 171ba39
Fix formatting
lukemaurer 3d952f6
Implement `register_parameter_import` and `is_registered_parameter_im…
lukemaurer 73835a0
Code review
lukemaurer f95b877
Merge branch 'as-parameter' into cu-name-is-cmi
lukemaurer e2c7976
Merge branch 'cu-name-is-cmi' into layered-persistent_env
lukemaurer 0c87e5c
Merge branch 'layered-persistent_env' into as-argument-for
lukemaurer cd5ff12
Fix missing change to use of `Env.read_signature`
lukemaurer c4a43ca
Merge branch 'cu-name-is-cmi' into layered-persistent_env
lukemaurer 68dd87f
Pass shape into `Env` callback
lukemaurer bc78a1d
Improve API for reading signatures from files
lukemaurer 3875b13
Merge branch 'layered-persistent_env' into as-argument-for
lukemaurer 0283acb
Forgot the code to check .mli files
lukemaurer 61b5aee
Forgot the code to access double module blocks correctly
lukemaurer 91ea4aa
Add missing objinfo code
lukemaurer 7b6d875
Pull in `print_global_line` early
lukemaurer ab62d1d
New library for computing instance names after substitution
lukemaurer 2caadb2
Rename library to `Global`; defunctorize; move test
lukemaurer 9124af4
Merge remote-tracking branch 'upstream/main' into instance-library
lukemaurer 4a5f03d
Hide records behind checked smart constructors
lukemaurer e901457
Have `subst` return original record if the result is equal
lukemaurer f8587a5
Fix bug introduced by last commit
lukemaurer 67ad5fe
Merge remote-tracking branch 'upstream/main' into instance-library
lukemaurer 4710f66
Pull in changes from the 'instance-typing' branch
lukemaurer 4b01ef5
Merge remote-tracking branch 'upstream/main' into instance-library
lukemaurer db4fa04
Make `Global.Name.print` act like `CU.Name.print` in simple cases
lukemaurer c24e14f
Code review
lukemaurer 4336e64
Merge remote-tracking branch 'upstream/main' into as-parameter
lukemaurer d530f6b
Add to .cmo format rather than only .cmx format
lukemaurer 8b52f69
Fix error message and re-enable test
lukemaurer c1ebcbe
Merge branch 'as-parameter' into cu-name-is-cmi
lukemaurer 2dda1ca
Fix compilation following merge
lukemaurer a3b7a31
Update bootstrap compiler
lukemaurer fa251ce
Fix upstream build
lukemaurer 6f86fb9
Disable test of error message
lukemaurer 88b6185
Merge branch 'cu-name-is-cmi' into layered-persistent_env
lukemaurer 52ea8fd
Revert "Disable test of error message"
lukemaurer a9eea0b
Fix upstream build
lukemaurer 4f01e24
Merge branch 'layered-persistent_env' into as-argument-for
lukemaurer b4ec625
Normalise test specification
lukemaurer 591a4ec
Generate test specifications
lukemaurer 268ebbd
Test native compilation
lukemaurer c15dcfb
Ability to add extra variables to actions in `gen_test`
lukemaurer 294ad42
Merge remote-tracking branch 'upstream/main' into as-parameter
lukemaurer 5518617
Merge remote-tracking branch 'upstream/main' into as-parameter
lukemaurer 77e4338
Merge branch 'as-parameter' into cu-name-is-cmi
lukemaurer 23adeca
Merge branch 'as-parameter' into cu-name-is-cmi
lukemaurer 9234fcd
Bootstrap
lukemaurer 4b2f192
Merge branch 'cu-name-is-cmi' into layered-persistent_env
lukemaurer 025558c
Remove warning boilerplate from new files
lukemaurer 4c0c8b6
Update `ocaml/.depend`
lukemaurer f494b9f
Merge branch 'layered-persistent_env' into as-argument-for
lukemaurer 3b8a7f5
Fix a bit of silly back-and-forth
lukemaurer daaf996
Update tests following rebase
lukemaurer 987a2bd
Partially fix Closure
lukemaurer 4dd61bb
Merge remote-tracking branch 'upstream/main' into as-parameter
lukemaurer c67a202
Merge remote-tracking branch 'upstream/main' into as-parameter
lukemaurer 4322629
Use unnamed field instead of double module block
lukemaurer 6d22bc4
Store argument block itself rather than coercion function
lukemaurer 398cc90
Bring in squashed merge of 'as-parameter' branch
lukemaurer 9db2c13
Merge branch 'unsquash/as-parameter' into cu-name-is-cmi
lukemaurer bf51bd8
Merge remote-tracking branch 'upstream/main' into cu-name-is-cmi
lukemaurer 28654cc
Merge remote-tracking branch 'upstream/main' into unsquash/as-parameter
lukemaurer f1e32a9
Merge branch 'unsquash/as-parameter' into cu-name-is-cmi
lukemaurer 3cb1126
Code review
lukemaurer e05a7f5
Code review
lukemaurer b3be73d
Merge branch 'cu-name-is-cmi' into layered-persistent_env
lukemaurer b07af9b
Merge branch 'layered-persistent_env' into as-argument-for
lukemaurer a277c51
Bootstrap
lukemaurer e8abb3a
Remove code gen changes from `-as-argument-for` branch
lukemaurer 7d6f798
Rename `secondary_interface` to `argument_interface`
lukemaurer ccd7064
Overhaul `Import_info` implementation and new API
lukemaurer c6f988b
Code review
lukemaurer 91c2329
Bootstrap
lukemaurer 8a2b5c2
Merge branch 'cu-name-is-cmi' into layered-persistent_env
lukemaurer a3641bb
Compilation fixes following merge
lukemaurer 7e760a1
Copy changes from `asmlink.ml` to `asmlink.ml`
lukemaurer 014a2d3
Rename a few things for consistency and update comments
lukemaurer 66fb8b8
Merge branch 'cu-name-is-cmi' into layered-persistent_env
lukemaurer 447c2dd
Merge remote-tracking branch 'upstream/main' into cu-name-is-cmi
lukemaurer f1be371
Merge branch 'layered-persistent_env' into as-argument-for
lukemaurer 91b0725
Merge branch 'cu-name-is-cmi' into layered-persistent_env
lukemaurer d701be1
Code review
lukemaurer d4cacae
Re-check visibility on _either_ cache hit
lukemaurer efd3020
Merge remote-tracking branch 'upstream/main' into cu-name-is-cmi
lukemaurer 2adb8bd
Rename a few things for code review
lukemaurer 381a67c
Merge branch 'cu-name-is-cmi' into layered-persistent_env
lukemaurer 4ad0aa3
Merge branch 'upstream/main' into layered-persistent_env, up to squas…
lukemaurer 5af30a5
Bring in squashed merge of 'cu-name-is-cmi' branch
lukemaurer f255c62
Merge remote-tracking branch 'upstream/main' into layered-persistent_env
lukemaurer 9fcab53
Merge branch 'layered-persistent_env' into as-argument-for
lukemaurer 288ed6c
Remove test spec generator
lukemaurer 5f5a85b
Merge remote-tracking branch 'upstream/main' into instance-library
lukemaurer 1159e12
Remove now-unused functions from `Misc`
lukemaurer 531c90c
Have `Global.subst` return whether the input changed
lukemaurer 1e681ac
Bring in squashed merge of 'layered-persistent_env' branch
lukemaurer 9dde77e
Rename `global.ml` to `global_module.ml` and move into `typing/`
lukemaurer 6272975
Improve error messages
lukemaurer 70a9aa2
Code review
lukemaurer 6733ace
Partially merge remote-tracking branch 'upstream/main' into as-argume…
lukemaurer a87959b
Merge remote-tracking branch 'upstream/main' into as-argument-for
lukemaurer 4061e54
Add unsquashed 'instance-library' branch as parent
lukemaurer 33a0476
Put back inadvertently-removed argument label in `Typemod`
lukemaurer 6e596bf
Don't register the argument type as a parameter import
lukemaurer 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
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,4 @@ | ||
type t = unit | ||
|
||
let empty = () | ||
let append () () = `Banana |
12 changes: 12 additions & 0 deletions
12
ocaml/testsuite/tests/templates/basic/bad_arg_impl.reference
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,12 @@ | ||
File "bad_arg_impl.ml", line 1: | ||
Error: The argument module bad_arg_impl.ml | ||
does not match the parameter signature monoid.cmi: | ||
Values do not match: | ||
val append : unit -> unit -> [> `Banana ] | ||
is not included in | ||
val append : t -> t -> t | ||
The type unit -> unit -> [> `Banana ] is not compatible with the type | ||
t -> t -> t | ||
Type [> `Banana ] is not compatible with type t = unit | ||
File "monoid.mli", line 4, characters 0-24: Expected declaration | ||
File "bad_arg_impl.ml", line 4, characters 4-10: Actual declaration |
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,4 @@ | ||
type t | ||
|
||
val empty : t | ||
val append : t -> t -> [ `Banana ] |
12 changes: 12 additions & 0 deletions
12
ocaml/testsuite/tests/templates/basic/bad_arg_intf.reference
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,12 @@ | ||
File "bad_arg_intf.mli", line 1: | ||
Error: The argument module bad_arg_intf.mli | ||
does not match the parameter signature monoid.cmi: | ||
Values do not match: | ||
val append : t -> t -> [ `Banana ] | ||
is not included in | ||
val append : t -> t -> t | ||
The type t -> t -> [ `Banana ] is not compatible with the type | ||
t -> t -> t | ||
Type [ `Banana ] is not compatible with type t | ||
File "monoid.mli", line 4, characters 0-24: Expected declaration | ||
File "bad_arg_intf.mli", line 4, characters 0-34: Actual declaration |
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,4 @@ | ||
type t = string | ||
|
||
let empty = "" | ||
let append = (^) |
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,4 @@ | ||
type t = string | ||
|
||
val empty : t | ||
val append : t -> t -> t |
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 |
---|---|---|
@@ -1,13 +1,136 @@ | ||
(* TEST | ||
readonly_files = "bad_ref_direct.ml bad_ref_direct.reference monoid.mli "; | ||
setup-ocamlc.byte-build-env; | ||
flags = "-as-parameter"; | ||
module = "monoid.mli"; | ||
ocamlc.byte; | ||
module = "bad_ref_direct.ml"; | ||
compiler_output = "bad_ref_direct.output"; | ||
ocamlc_byte_exit_status = "2"; | ||
ocamlc.byte; | ||
compiler_reference = "bad_ref_direct.reference"; | ||
check-ocamlc.byte-output; | ||
readonly_files = "\ | ||
bad_arg_impl.ml bad_arg_impl.reference \ | ||
bad_arg_intf.mli bad_arg_intf.reference \ | ||
bad_ref_direct.ml bad_ref_direct.reference \ | ||
monoid.mli \ | ||
string_monoid.ml string_monoid.mli \ | ||
test_direct_access.ml test_direct_access.reference \ | ||
"; | ||
|
||
{ | ||
setup-ocamlc.byte-build-env; | ||
|
||
flags = "-as-parameter"; | ||
module = "monoid.mli"; | ||
ocamlc.byte; | ||
{ | ||
flags = ""; | ||
module = "bad_ref_direct.ml"; | ||
compiler_output = "bad_ref_direct.output"; | ||
ocamlc_byte_exit_status = "2"; | ||
ocamlc.byte; | ||
|
||
compiler_reference = "bad_ref_direct.reference"; | ||
check-ocamlc.byte-output; | ||
}{ | ||
flags = "-as-argument-for Monoid"; | ||
module = "bad_arg_impl.ml"; | ||
compiler_output = "bad_arg_impl.output"; | ||
ocamlc_byte_exit_status = "2"; | ||
ocamlc.byte; | ||
|
||
compiler_reference = "bad_arg_impl.reference"; | ||
check-ocamlc.byte-output; | ||
}{ | ||
flags = "-as-argument-for Monoid"; | ||
module = "bad_arg_intf.mli"; | ||
compiler_output = "bad_arg_intf.output"; | ||
ocamlc_byte_exit_status = "2"; | ||
ocamlc.byte; | ||
|
||
compiler_reference = "bad_arg_intf.reference"; | ||
check-ocamlc.byte-output; | ||
}{ | ||
src = "string_monoid.ml"; | ||
dst = "string_monoid_no_mli.ml"; | ||
copy; | ||
|
||
flags = "-as-argument-for Monoid"; | ||
module = "string_monoid_no_mli.ml string_monoid.mli string_monoid.ml"; | ||
ocamlc.byte; | ||
|
||
flags = ""; | ||
module = "test_direct_access.ml"; | ||
ocamlc.byte; | ||
|
||
flags = ""; | ||
program = "${test_build_directory}/test_direct_access.bc"; | ||
module = ""; | ||
all_modules = "\ | ||
string_monoid.cmo \ | ||
string_monoid_no_mli.cmo \ | ||
test_direct_access.cmo \ | ||
"; | ||
ocamlc.byte; | ||
|
||
output = "test_direct_access.output"; | ||
run; | ||
|
||
reference = "test_direct_access.reference"; | ||
check-program-output; | ||
} | ||
}{ | ||
setup-ocamlopt.byte-build-env; | ||
|
||
flags = "-as-parameter"; | ||
module = "monoid.mli"; | ||
ocamlopt.byte; | ||
{ | ||
flags = ""; | ||
module = "bad_ref_direct.ml"; | ||
compiler_output = "bad_ref_direct.output"; | ||
ocamlopt_byte_exit_status = "2"; | ||
ocamlopt.byte; | ||
|
||
compiler_reference = "bad_ref_direct.reference"; | ||
check-ocamlopt.byte-output; | ||
}{ | ||
flags = "-as-argument-for Monoid"; | ||
module = "bad_arg_impl.ml"; | ||
compiler_output = "bad_arg_impl.output"; | ||
ocamlopt_byte_exit_status = "2"; | ||
ocamlopt.byte; | ||
|
||
compiler_reference = "bad_arg_impl.reference"; | ||
check-ocamlopt.byte-output; | ||
}{ | ||
flags = "-as-argument-for Monoid"; | ||
module = "bad_arg_intf.mli"; | ||
compiler_output = "bad_arg_intf.output"; | ||
ocamlopt_byte_exit_status = "2"; | ||
ocamlopt.byte; | ||
|
||
compiler_reference = "bad_arg_intf.reference"; | ||
check-ocamlopt.byte-output; | ||
}{ | ||
src = "string_monoid.ml"; | ||
dst = "string_monoid_no_mli.ml"; | ||
copy; | ||
|
||
flags = "-as-argument-for Monoid"; | ||
module = "string_monoid_no_mli.ml string_monoid.mli string_monoid.ml"; | ||
ocamlopt.byte; | ||
|
||
flags = ""; | ||
module = "test_direct_access.ml"; | ||
ocamlopt.byte; | ||
|
||
flags = ""; | ||
program = "${test_build_directory}/test_direct_access.exe"; | ||
module = ""; | ||
all_modules = "\ | ||
string_monoid.cmx \ | ||
string_monoid_no_mli.cmx \ | ||
test_direct_access.cmx \ | ||
"; | ||
ocamlopt.byte; | ||
|
||
output = "test_direct_access.output"; | ||
run; | ||
|
||
reference = "test_direct_access.reference"; | ||
check-program-output; | ||
} | ||
} | ||
*) |
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 @@ | ||
let () = | ||
let open Printf in | ||
printf "With .mli: %s\n" (String_monoid.append "Hello " "world!"); | ||
printf "Without .mli: %s\n" (String_monoid_no_mli.append "Hello " "world!"); | ||
() |
2 changes: 2 additions & 0 deletions
2
ocaml/testsuite/tests/templates/basic/test_direct_access.reference
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,2 @@ | ||
With .mli: Hello world! | ||
Without .mli: Hello world! |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.