Skip to content

Commit

Permalink
test: unsupported melange primitives in OCaml 5
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro committed Jul 29, 2023
1 parent d40ada3 commit aacc66f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jscomp/core/lam_convert.ml
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args loc : Lam.t =
| Prunstack | Pperform | Presume | Preperform | Patomic_exchange | Patomic_cas
| Patomic_fetch_add | Pdls_get | Patomic_load _ ->
Location.raise_errorf ~loc
"OCaml 5 multicore primitives (Effect, Domain, Condition, Mutex, \
Semaphore) are not supported in Melange"
"OCaml 5 multicore primitives (Effect, Condition, Semaphore) are not \
currently supported in Melange"

(* Does not exist since we compile array in js backend unlike native backend *)

Expand Down
18 changes: 18 additions & 0 deletions test/blackbox-tests/unsupported-ocaml5-primitives.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Demonstrate OCaml 5 primitives that are currently unsupported in Melange

$ . ./setup.sh

%perform is an Effects primitive in OCaml 5

$ cat > x.ml <<EOF
> type 'a t
> external perform : 'a t -> 'a = "%perform"
> let () = perform (Obj.magic ())
> EOF
$ melc x.ml
File "x.ml", line 3, characters 9-31:
3 | let () = perform (Obj.magic ())
^^^^^^^^^^^^^^^^^^^^^^
Error: OCaml 5 multicore primitives (Effect, Condition, Semaphore) are not currently supported in Melange
[2]

0 comments on commit aacc66f

Please sign in to comment.