Skip to content
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

Name collisions between STM and user-provided code #231

Open
shym opened this issue May 24, 2024 · 0 comments
Open

Name collisions between STM and user-provided code #231

shym opened this issue May 24, 2024 · 0 comments

Comments

@shym
Copy link
Contributor

shym commented May 24, 2024

Currently there is no protection against collisions between the namespaces of STM and of the user-provided code.

Here is a simple example, renaming the base type in ref.ml from t to ty, to match the base type in STM.

diff --git i/plugins/qcheck-stm/test/ref.ml w/plugins/qcheck-stm/test/ref.ml
index a105d98..c67cd35 100644
--- i/plugins/qcheck-stm/test/ref.ml
+++ w/plugins/qcheck-stm/test/ref.ml
@@ -1,4 +1,4 @@
-type t = int ref
+type ty = int ref

 let make = ref
 let get r = !r
diff --git i/plugins/qcheck-stm/test/ref.mli w/plugins/qcheck-stm/test/ref.mli
index 2cd26e7..9f37a5f 100644
--- i/plugins/qcheck-stm/test/ref.mli
+++ w/plugins/qcheck-stm/test/ref.mli
@@ -1,11 +1,11 @@
-type t = private int ref
+type ty = private int ref
 (*@ mutable model value : integer *)

-val make : int -> t
+val make : int -> ty
 (*@ r = make i
     ensures r.value = i *)

-val get : t -> int
+val get : ty -> int
 (*@ i = get r
     pure
     ensures i = r.value

The generated code fails to compile with the following error:

File "plugins/qcheck-stm/test/ref_stm_tests.ml", line 9, characters 15-17:
9 |     type sut = ty
                   ^^
Error: The type constructor ty expects 1 argument(s),
       but is here applied to 0 argument(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant