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

Check arity of primitives #2015

Merged
merged 1 commit into from Sep 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changes
Expand Up @@ -410,6 +410,9 @@ Working version
an `open` statement for which the `.cmi` is not available.
(Nicolás Ojeda Bär, report by Jocelyn Sérot, review by Gabriel Scherer)

- MPR#7408, MPR#7846, GPR#2015: Check arity of primitives.
(Hugo Heuzard, review by Nicolás Ojeda Bär)

OCaml 4.07 maintenance branch
-----------------------------

Expand Down
7 changes: 5 additions & 2 deletions bytecomp/translmod.ml
Expand Up @@ -175,7 +175,8 @@ let compose_coercions c1 c2 =

let primitive_declarations = ref ([] : Primitive.description list)
let record_primitive = function
| {val_kind=Val_prim p} ->
| {val_kind=Val_prim p;val_loc} ->
Translprim.check_primitive_arity val_loc p;
primitive_declarations := p :: !primitive_declarations
| _ -> ()

Expand Down Expand Up @@ -1245,9 +1246,11 @@ let transl_toplevel_item item =
set_idents (pos + 1) ids) in
Llet(Strict, Pgenval, mid,
transl_module Tcoerce_none None modl, set_idents 0 ids)
| Tstr_primitive descr ->
record_primitive descr.val_val;
lambda_unit
| Tstr_modtype _
| Tstr_open _
| Tstr_primitive _
| Tstr_type _
| Tstr_class_type _
| Tstr_attribute _ ->
Expand Down